From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00BBBC433FE for ; Thu, 29 Sep 2022 10:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PcOUF/n7YlQCedL7t8L1zaBrkTeWtVyrI9X1eY685Es=; b=F7e5ybdZk3rd1O 6LT4C0w6hVkkhpyTFe/eYL0XgIearb6BQS3hvtWoRnxrZ+ombgfgRnqLyBM9S+0/81/j4H0SCo7Aj rX+HNLCPXptrR2IubkHQ7nBta/Lm5QOs6t41acfpbJLU81V85EGvCrivQ3PX5b3XZ8/YO4YPXE8i3 U3tDCBfCW00qwkzaDpt0ArDSr1ZXGquDgL+X02dIRIYw5AIzgttuKFRVFJealQDVpOhFTqWmykcEp iJFShcvUnJf8UhclmJ9UiYR22jXgY6l8WkvihLGMm1094tTU+DPOmGsc4Sgoyv7quWjbZPOoNPb1P uyDbw5C5aVAFpqlMRYsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1odqgV-002O74-Oi; Thu, 29 Sep 2022 10:22:27 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1odqgR-002O4G-Bx for linux-arm-kernel@lists.infradead.org; Thu, 29 Sep 2022 10:22:26 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 31BC52309; Thu, 29 Sep 2022 03:22:27 -0700 (PDT) Received: from [10.57.65.170] (unknown [10.57.65.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3DDE53F73B; Thu, 29 Sep 2022 03:22:19 -0700 (PDT) Message-ID: <0862c961-d047-6c5d-e577-62a58b1d1bc5@arm.com> Date: Thu, 29 Sep 2022 11:22:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH] ACPI/IORT: Update SMMUv3 DeviceID support Content-Language: en-GB To: Nicolin Chen Cc: lpieralisi@kernel.org, guohanjun@huawei.com, sudeep.holla@arm.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, will@kernel.org, catalin.marinas@arm.com References: <4b3e2ead4f392d1a47a7528da119d57918e5d806.1664392886.git.robin.murphy@arm.com> From: Robin Murphy In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220929_032223_542696_1BE030D1 X-CRM114-Status: GOOD ( 26.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-09-29 00:55, Nicolin Chen wrote: > On Wed, Sep 28, 2022 at 08:21:26PM +0100, Robin Murphy wrote: >> External email: Use caution opening links or attachments >> >> >> IORT E.e now allows SMMUv3 nodes to describe the DeviceID for MSIs >> independently of wired GSIVs, where the previous oddly-restrictive >> definition meant that an SMMU without PRI support had to provide a >> DeviceID even if it didn't support MSIs either. Support this, with >> the usual temporary flag definition while the real one is making >> its way through ACPICA. >> >> Signed-off-by: Robin Murphy > > All the indentations in this patch are using white spaces vs. tabs, That must be something at your end - they're definitely tabs here, and the copy in the lore archives looks right too. > so it fails at git-apply. I manually fixed them and tested the PATCH > by applying a small revision hack to the IORT binaries: > > --------- > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > index 3269a888fb7a..5a4eef7b937c 100644 > --- a/drivers/acpi/osl.c > +++ b/drivers/acpi/osl.c > @@ -333,8 +333,20 @@ void __iomem __ref > return NULL; > } > > - if (!acpi_permanent_mmap) > - return __acpi_map_table((unsigned long)phys, size); > + if (!acpi_permanent_mmap) { > + virt = __acpi_map_table((unsigned long)phys, size); > + if (!strncmp((char *)virt, "IORT", 4)) { > + u8 *tmp = virt; > + int i = 0x30; > + while (i < size) { > + if (tmp[i] == 0x4) /* SMMUv3 */ > + tmp[i + 3] = 0x5; /* Revision */ > + i += tmp[i + 1]; /* next node */ > + continue; > + } > + } > + return virt; > + } > > mutex_lock(&acpi_ioremap_lock); > /* Check if there's a suitable mapping already. */ > --------- > > Once the indentations are fixed, > > Tested-by: Nicolin Chen > Reviewed-by: Nicolin Chen Thanks for confirming! Robin. > > Thanks! > Nicolin > >> --- >> drivers/acpi/arm64/iort.c | 16 ++++++++++++---- >> 1 file changed, 12 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c >> index ca2aed86b540..51bc3c1d8d42 100644 >> --- a/drivers/acpi/arm64/iort.c >> +++ b/drivers/acpi/arm64/iort.c >> @@ -402,6 +402,10 @@ static struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node, >> return NULL; >> } >> >> +#ifndef ACPI_IORT_SMMU_V3_DEVICEID_VALID >> +#define ACPI_IORT_SMMU_V3_DEVICEID_VALID (1 << 4) >> +#endif >> + >> static int iort_get_id_mapping_index(struct acpi_iort_node *node) >> { >> struct acpi_iort_smmu_v3 *smmu; >> @@ -418,12 +422,16 @@ static int iort_get_id_mapping_index(struct acpi_iort_node *node) >> >> smmu = (struct acpi_iort_smmu_v3 *)node->node_data; >> /* >> - * ID mapping index is only ignored if all interrupts are >> - * GSIV based >> + * Until IORT E.e (node rev. 5), the ID mapping index was >> + * defined to be valid unless all interrupts are GSIV-based. >> */ >> - if (smmu->event_gsiv && smmu->pri_gsiv && smmu->gerr_gsiv >> - && smmu->sync_gsiv) >> + if (node->revision < 5) { >> + if (smmu->event_gsiv && smmu->pri_gsiv && >> + smmu->gerr_gsiv && smmu->sync_gsiv) >> + return -EINVAL; >> + } else if (!(smmu->flags & ACPI_IORT_SMMU_V3_DEVICEID_VALID)) { >> return -EINVAL; >> + } >> >> if (smmu->id_mapping_index >= node->mapping_count) { >> pr_err(FW_BUG "[node %p type %d] ID mapping index overflows valid mappings\n", >> -- >> 2.36.1.dirty >> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel