Linux IOMMU Development
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Salil Mehta <salil.mehta@huawei.com>,
	Arnd Bergmann <arnd@kernel.org>,
	"shenjian (K)" <shenjian15@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Will Deacon <will@kernel.org>,
	Joerg Roedel <jroedel@suse.de>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	shaojijie <shaojijie@huawei.com>,
	wangpeiyang <wangpeiyang1@huawei.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [net-next] net: hns3: add IOMMU_SUPPORT dependency
Date: Mon, 4 Nov 2024 16:34:46 +0000	[thread overview]
Message-ID: <29d5918e-cfe2-4b36-b0f1-a1379075dd05@arm.com> (raw)
In-Reply-To: <a94f95bd661c4978bb843c8a1af73818@huawei.com>

On 2024-11-04 10:50 am, Salil Mehta wrote:
>>   From: Salil Mehta <salil.mehta@huawei.com>
>>   Sent: Monday, November 4, 2024 10:41 AM
>>   To: Robin Murphy <robin.murphy@arm.com>; Arnd Bergmann
>>   <arnd@kernel.org>; shenjian (K) <shenjian15@huawei.com>
>>   
>>   HI Robin,
>>   
>>   >  From: Robin Murphy <robin.murphy@arm.com>
>>   >  Sent: Monday, November 4, 2024 10:29 AM
>>   >  To: Arnd Bergmann <arnd@kernel.org>; shenjian (K)
>>   > <shenjian15@huawei.com>; Salil Mehta <salil.mehta@huawei.com>
>>   >  Cc: Arnd Bergmann <arnd@arndb.de>; Will Deacon <will@kernel.org>;
>>   > Joerg Roedel <jroedel@suse.de>; iommu@lists.linux.dev; Andrew Lunn
>>   > <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>;
>>   Eric
>>   > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
>>   > Paolo Abeni <pabeni@redhat.com>; shaojijie <shaojijie@huawei.com>;
>>   > wangpeiyang <wangpeiyang1@huawei.com>; netdev@vger.kernel.org;
>>   > linux-kernel@vger.kernel.org
>>   >  Subject: Re: [PATCH] [net-next] net: hns3: add IOMMU_SUPPORT
>>   > dependency
>>   >
>>   >  On 2024-11-04 8:21 am, Arnd Bergmann wrote:
>>   >  > From: Arnd Bergmann <arnd@arndb.de>  >  > The hns3 driver started
>>   > filling iommu_iotlb_gather structures itself,  > which requires
>>   > CONFIG_IOMMU_SUPPORT is enabled:
>>   >  >
>>   >  > drivers/net/ethernet/hisilicon/hns3/hns3_enet.c: In function
>>   >  'hns3_dma_map_sync':
>>   >  > drivers/net/ethernet/hisilicon/hns3/hns3_enet.c:395:14: error:
>>   > 'struct  iommu_iotlb_gather' has no member named 'start'
>>   >  >    395 |  iotlb_gather.start = iova;
>>   >  >        |              ^
>>   >  > drivers/net/ethernet/hisilicon/hns3/hns3_enet.c:396:14: error:
>>   > 'struct  iommu_iotlb_gather' has no member named 'end'
>>   >  >    396 |  iotlb_gather.end = iova + granule - 1;
>>   >  >        |              ^
>>   >  > drivers/net/ethernet/hisilicon/hns3/hns3_enet.c:397:14: error:
>>   > 'struct  iommu_iotlb_gather' has no member named 'pgsize'
>>   >  >    397 |  iotlb_gather.pgsize = granule;
>>   >  >        |              ^
>>   >  >
>>   >  > Add a Kconfig dependency to make it build in random configurations.
>>   >  >
>>   >  > Cc: Will Deacon <will@kernel.org>
>>   >  > Cc: Joerg Roedel <jroedel@suse.de>
>>   >  > Cc: Robin Murphy <robin.murphy@arm.com>  > Cc:
>>   > iommu@lists.linux.dev  > Fixes: f2c14899caba ("net: hns3: add sync
>>   > command to sync io-pgtable")  > Signed-off-by: Arnd Bergmann
>>   > <arnd@arndb.de>  > ---  > I noticed that no other driver does this, so
>>   > it would be good to have  > a confirmation from the iommu maintainers
>>   > that this is how the  > interface and the dependency is intended to be
>>   > used.
>>   >
>>   >  WTF is that patch doing!? No, random device drivers should absolutely
>>   > not  be poking into IOMMU driver internals, this is egregiously wrong
>>   > and the  correct action is to drop it entirely.
>>   
>>   
>>   Absolutely agree with it. Sorry I haven't been in touch for quite some time.
>>   Let me catch the whole story.  Feel free to drop this patch.
> 
> 
> Just to make it clear I meant the culprit patch:
> https://lore.kernel.org/netdev/20241025092938.2912958-3-shaojijie@huawei.com/

Right, if the HIP09 SMMU has a bug which requires an 
iommu_domain_ops::iotlb_sync_map workaround, then the SMMU driver should 
detect the HIP09 SMMU and implement that workaround for it. HNS3 trying 
to reach in to the SMMU driver's data and open-code iotlb_sync_map on 
its behalf is just as plain illogical as it is unacceptable.

Thanks,
Robin.

  reply	other threads:[~2024-11-04 16:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04  8:21 [PATCH] [net-next] net: hns3: add IOMMU_SUPPORT dependency Arnd Bergmann
2024-11-04 10:29 ` Robin Murphy
2024-11-04 10:40   ` Salil Mehta
2024-11-04 10:50     ` Salil Mehta
2024-11-04 16:34       ` Robin Murphy [this message]
2024-11-06 19:39         ` Salil Mehta
2024-11-04 12:01   ` Pranjal Shrivastava
2024-11-05  2:10   ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29d5918e-cfe2-4b36-b0f1-a1379075dd05@arm.com \
    --to=robin.murphy@arm.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=jroedel@suse.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=wangpeiyang1@huawei.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox