[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen/arm: smmuv3: mark arm_smmu_disable_pasid __maybe_unused


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Thu, 15 Dec 2022 09:11:33 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jNVfxjfHJSNLJATCzMSqQBCV7zGKI0OdeLeko8mZFbg=; b=K4ksxnFx9OxE68+KZ5sK0Sizyr+Bb2Ih4VnQ/S9r6SE6enuEvUp4NPdi5tfXnJuf1bsLmVw77uLI6jRXIqea/WLFgJITskhsPCrGJWDXyW7dlMQjuFiTfrY9ZKN+b8CLX1jSH9kP0BwPjpYBUlboInahIPtc2BmuljCkxs9LXrL5g/uReeiVYgBndvGbTbbIFqWaNq5EN03I4Hu3C4kqNM2Mqt7/i/UAPCMiLBvZRN50/ocyaV1a93cQA5Ehg/ASr0lMjBc+HwNPTFK3UiofMiSSHH7EFOFiGPd8cwOVybZgItYnKmA7iL3mj9xKbHwVh1snAA+Bz9NGKxhe7aGBIw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZIixFTJezEdTkszbGje2oSPAZ5EzqOW6UPtlrLzxyYQtfXyqCQ5x/7tjsDI/NG1EDMlgsX6LTi1CSTCPp2chNnpdXD+PhWLUPJcj2bOKVCEabTH9ii5c6Tvg/2CoOyoCHhX5jV+vcZ+FlXhIMyXLldduGqELeH/e21JPKp6t86do7BTAoaXYC9+W+VmaCZeoqf6z+y2dBntEk8RI2bpavZWtiOchZtfKCY3P9u50W/AGVK7upDRE+ju/yeR9wZc+89kMH2ULejdqoxxl+2aw6myt1OuaqvEvcWqsox12rKncCpgnzjjdCesHJFaIOp5J9eBq5j4u1Jh++TPgfxu0g==
  • Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 15 Dec 2022 14:11:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12/15/22 06:34, Julien Grall wrote:
> Hi Stewart,
> 
> I was about to commit this patch when I noticed the placement of the
> attribute doesn't match what we are usually doing in Xen.
> 
> On 13/12/2022 18:18, Stewart Hildebrand wrote:
>> When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the
>> following build error:
>>
>> drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 
>> 'arm_smmu_disable_pasid' [-Werror,-Wunused-function]
>> static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
>>                     ^
>>
>> arm_smmu_disable_pasid is not currently called from anywhere in Xen, but
>> it is inside a section of code guarded by CONFIG_PCI_ATS, which may be
>> helpful in the future if the PASID feature is to be implemented. Add the
>> attribute __maybe_unused to the function.
>>
>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
>> ---
>> v1->v2:
>> Add __maybe_unused attribute instead of removing
>> ---
>>   xen/drivers/passthrough/arm/smmu-v3.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
>> b/xen/drivers/passthrough/arm/smmu-v3.c
>> index 9c9f4630090e..0cdc862f96d1 100644
>> --- a/xen/drivers/passthrough/arm/smmu-v3.c
>> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
>> @@ -1376,6 +1376,7 @@ static int arm_smmu_enable_pasid(struct 
>> arm_smmu_master *master)
>>       return 0;
>>   }
>>
>> +__maybe_unused
>>   static void arm_smmu_disable_pasid(struct arm_smmu_master *master)
> 
> The attribute should be placed after "void". I.e.:
> 
> static void __maybe_unused arm_smmu_disable_pasid(...)

I had initially tried placing it exactly where you suggest in the first draft 
of v2 of this patch. However, the line would then exceed 72 characters (actual 
81 characters):

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master 
*master)

So I found myself juggling with how best to wrap it. How about a newline after 
the __maybe_unused attribute?

static void __maybe_unused
arm_smmu_disable_pasid(struct arm_smmu_master *master)

and similarly for the 2nd occurrence:

static inline void __maybe_unused
arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

There is precedent for this style of wrapping in xen/common/sched/credit2.c.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.