Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-21 Thread Jason Wang
在 2021/6/21 下午6:41, Yongji Xie 写道: On Mon, Jun 21, 2021 at 5:14 PM Jason Wang wrote: 在 2021/6/15 下午10:13, Xie Yongji 写道: This VDUSE driver enables implementing vDPA devices in userspace. The vDPA device's control path is handled in kernel and the data path is handled in userspace. A message

Re: [PATCH 4/6] iommu: Combine device strictness requests with the global default

2021-06-21 Thread Saravana Kannan via iommu
On Mon, Jun 21, 2021 at 4:53 PM Douglas Anderson wrote: > > In the patch ("drivers: base: Add bits to struct device to control > iommu strictness") we add the ability for devices to tell us about > their IOMMU strictness requirements. Let's now take that into account > in the IOMMU layer. > > A fe

Re: [PATCH 4/6] iommu: Combine device strictness requests with the global default

2021-06-21 Thread Lu Baolu
On 6/22/21 7:52 AM, Douglas Anderson wrote: @@ -1519,7 +1542,8 @@ static int iommu_get_def_domain_type(struct device *dev) static int iommu_group_alloc_default_domain(struct bus_type *bus, struct iommu_group *group, -

[PATCH 6/6] mmc: sdhci-msm: Request non-strict IOMMU mode

2021-06-21 Thread Douglas Anderson
IOMMUs can be run in "strict" mode or in "non-strict" mode. The quick-summary difference between the two is that in "strict" mode we wait until everything is flushed out when we unmap DMA memory. In "non-strict" we don't. Using the IOMMU in "strict" mode is more secure/safer but slower because we

[PATCH 5/6] iommu: Stop reaching into PCIe devices to decide strict vs. non-strict

2021-06-21 Thread Douglas Anderson
We now have a way for PCIe devices to force iommu.strict through the "struct device" and that's now hooked up. Let's remove the special case for PCIe devices. NOTE: there are still other places in this file that make decisions based on the PCIe "untrusted" status. This patch only handles removing

[PATCH 4/6] iommu: Combine device strictness requests with the global default

2021-06-21 Thread Douglas Anderson
In the patch ("drivers: base: Add bits to struct device to control iommu strictness") we add the ability for devices to tell us about their IOMMU strictness requirements. Let's now take that into account in the IOMMU layer. A few notes here: * Presumably this is always how iommu_get_dma_strict() w

[PATCH 3/6] PCI: Indicate that we want to force strict DMA for untrusted devices

2021-06-21 Thread Douglas Anderson
At the moment the generic IOMMU framework reaches into the PCIe device to check the "untrusted" state and uses this information to figure out if it should be running the IOMMU in strict or non-strict mode. Let's instead set the new boolean in "struct device" to indicate when we want forced strictne

[PATCH 2/6] drivers: base: Add bits to struct device to control iommu strictness

2021-06-21 Thread Douglas Anderson
How to control the "strictness" of an IOMMU is a bit of a mess right now. As far as I can tell, right now: * You can set the default to "non-strict" and some devices (right now, only PCI devices) can request to run in "strict" mode. * You can set the default to "strict" and no devices in the syst

[PATCH 1/6] drivers: base: Add the concept of "pre_probe" to drivers

2021-06-21 Thread Douglas Anderson
Right now things are a bit awkward if a driver would like a chance to run before some of the more "automatic" things (pinctrl, DMA, IOMMUs, ...) happen to a device. This patch aims to fix that problem by introducing the concept of a "pre_probe" function that drivers can implement to run before the

[PATCH 0/6] iommu: Enable devices to request non-strict DMA, starting with QCom SD/MMC

2021-06-21 Thread Douglas Anderson
This patch attempts to put forward a proposal for enabling non-strict DMA on a device-by-device basis. The patch series requests non-strict DMA for the Qualcomm SDHCI controller as a first device to enable, getting a nice bump in performance with what's believed to be a very small drop in securit

Re: [PATCH v2 12/12] iommu: Do not allow IOMMU passthrough with Secure Launch

2021-06-21 Thread Andy Lutomirski
On Mon, Jun 21, 2021 at 10:51 AM Ross Philipson wrote: > > On 6/18/21 2:32 PM, Robin Murphy wrote: > > On 2021-06-18 17:12, Ross Philipson wrote: > >> The IOMMU should always be set to default translated type after > >> the PMRs are disabled to protect the MLE from DMA. > >> > >> Signed-off-by: Ro

Re: [PATCH v13 01/12] swiotlb: Refactor swiotlb init functions

2021-06-21 Thread Christoph Hellwig
On Mon, Jun 21, 2021 at 10:59:20AM -0700, Stefano Stabellini wrote: > Just as a clarification: I was referring to the zeroing of "mem" in > swiotlb_late_init_with_tbl and swiotlb_init_with_tbl. While it looks > like Tom and Christoph are talking about the zeroing of "tlb". Indeed. > > The zeroi

Re: [PATCH v13 01/12] swiotlb: Refactor swiotlb init functions

2021-06-21 Thread Stefano Stabellini
On Fri, 18 Jun 2021, Christoph Hellwig wrote: > On Fri, Jun 18, 2021 at 09:09:17AM -0500, Tom Lendacky wrote: > > > swiotlb_init_with_tbl uses memblock_alloc to allocate the io_tlb_mem > > > and memblock_alloc[1] will do memset in memblock_alloc_try_nid[2], so > > > swiotlb_init_with_tbl is also go

Re: [PATCH v2 12/12] iommu: Do not allow IOMMU passthrough with Secure Launch

2021-06-21 Thread Ross Philipson
On 6/18/21 2:32 PM, Robin Murphy wrote: > On 2021-06-18 17:12, Ross Philipson wrote: >> The IOMMU should always be set to default translated type after >> the PMRs are disabled to protect the MLE from DMA. >> >> Signed-off-by: Ross Philipson >> --- >>   drivers/iommu/intel/iommu.c | 5 + >>   d

[PATCH] iommu/arm-smmu-v3: Remove some unneeded init in arm_smmu_cmdq_issue_cmdlist()

2021-06-21 Thread John Garry
Members of struct "llq" will be zero-inited, apart from member max_n_shift. But we write llq.val straight after the init, so it was pointless to zero init those other members. As such, separately init member max_n_shift only. In addition, struct "head" is initialised to "llq" only so that member m

Re: [PATCHv2 2/3] iommu/io-pgtable: Optimize partial walk flush for large scatter-gather list

2021-06-21 Thread Robin Murphy
On 2021-06-21 06:47, Sai Prakash Ranjan wrote: Hi, On 2021-06-19 03:39, Doug Anderson wrote: Hi, On Thu, Jun 17, 2021 at 7:51 PM Sai Prakash Ranjan wrote: Currently for iommu_unmap() of large scatter-gather list with page size elements, the majority of time is spent in flushing of partial w

Re: [PATCH v3 2/9] dt-bindings: arm-smmu: Add Tegra186 compatible string

2021-06-21 Thread Thierry Reding
On Mon, Jun 21, 2021 at 04:54:18PM +0100, Will Deacon wrote: > On Mon, Jun 21, 2021 at 04:11:55PM +0200, Thierry Reding wrote: > > On Mon, Jun 21, 2021 at 08:46:54AM +0200, Krzysztof Kozlowski wrote: > > > On 18/06/2021 21:47, Rob Herring wrote: > > > > On Thu, Jun 3, 2021 at 10:49 AM Thierry Redin

Re: [PATCH v3 2/9] dt-bindings: arm-smmu: Add Tegra186 compatible string

2021-06-21 Thread Will Deacon
On Mon, Jun 21, 2021 at 04:11:55PM +0200, Thierry Reding wrote: > On Mon, Jun 21, 2021 at 08:46:54AM +0200, Krzysztof Kozlowski wrote: > > On 18/06/2021 21:47, Rob Herring wrote: > > > On Thu, Jun 3, 2021 at 10:49 AM Thierry Reding > > > wrote: > > >> diff --git a/Documentation/devicetree/binding

Re: [PATCHv2 1/3] iommu/io-pgtable: Add a quirk to use tlb_flush_all() for partial walk flush

2021-06-21 Thread Robin Murphy
On 2021-06-18 03:51, Sai Prakash Ranjan wrote: Add a quirk IO_PGTABLE_QUIRK_TLB_INV_ALL to invalidate entire context with tlb_flush_all() callback in partial walk flush to improve unmap performance on select few platforms where the cost of over-invalidation is less than the unmap latency. I sti

Re: [PATCH v14 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

2021-06-21 Thread Lu Baolu
Hi Robin, On 2021/6/21 19:59, Robin Murphy wrote: On 2021-06-21 11:34, John Garry wrote: On 21/06/2021 11:00, Lu Baolu wrote: void iommu_set_dma_strict(bool force) {   if (force == true) iommu_dma_strict = true;  else if (!(iommu_cmd_line & IOMMU_CMD_LINE_STRICT))

Re: [PATCH v3 2/9] dt-bindings: arm-smmu: Add Tegra186 compatible string

2021-06-21 Thread Thierry Reding
On Mon, Jun 21, 2021 at 08:46:54AM +0200, Krzysztof Kozlowski wrote: > On 18/06/2021 21:47, Rob Herring wrote: > > On Thu, Jun 3, 2021 at 10:49 AM Thierry Reding > > wrote: > >> > >> From: Thierry Reding > >> > >> The ARM SMMU instantiations found on Tegra186 and later need inter- > >> operation

[PATCH] dt-bindings: arm-smmu: Fix json-schema syntax

2021-06-21 Thread Thierry Reding
From: Thierry Reding Commit 4287861dca9d ("dt-bindings: arm-smmu: Add Tegra186 compatible string") introduced a jsonschema syntax error as a result of a rebase gone wrong. Fix it. Fixes: 4287861dca9d ("dt-bindings: arm-smmu: Add Tegra186 compatible string") Reported-by: Rob Herring Signed-off-b

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-21 Thread Konrad Rzeszutek Wilk
On Mon, Jun 21, 2021 at 01:14:48PM +0900, 'Dominique MARTINET' wrote: > Chanho Park wrote on Mon, Jun 21, 2021 at 11:55:22AM +0900: > > Sure. No problem. But, the patch was already stacked on Konrad's tree > > and linux-next as well. > > > > https://git.kernel.org/pub/scm/linux/kernel/git/konrad/s

Re: [PATCH v4 2/7] iommu/amd: Do not use flush-queue when NpCache is on

2021-06-21 Thread John Garry
On 16/06/2021 11:04, Nadav Amit wrote: - if (iommu->cap & (1UL << IOMMU_CAP_NPCACHE)) + if (iommu->cap & (1UL << IOMMU_CAP_NPCACHE)) { + if (!amd_iommu_unmap_flush) + pr_warn("IOMMU batching is disabled due to virtualization"); This is missing th

Re: [PATCH v14 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

2021-06-21 Thread John Garry
On 21/06/2021 12:59, Robin Murphy wrote: + Nadav On a personal level I would be happy with that approach, but I think it's better to not start changing things right away in a follow-up series. So how about we add this patch (which replaces 6/6 "iommu: Remove mode argument from iommu_set_dma_st

Re: [PATCH v14 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

2021-06-21 Thread Robin Murphy
On 2021-06-21 11:34, John Garry wrote: On 21/06/2021 11:00, Lu Baolu wrote: void iommu_set_dma_strict(bool force) {   if (force == true) iommu_dma_strict = true;  else if (!(iommu_cmd_line & IOMMU_CMD_LINE_STRICT)) iommu_dma_strict = true; } So we would use iommu_s

Re: Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-21 Thread Yongji Xie
On Mon, Jun 21, 2021 at 5:14 PM Jason Wang wrote: > > > 在 2021/6/15 下午10:13, Xie Yongji 写道: > > This VDUSE driver enables implementing vDPA devices in userspace. > > The vDPA device's control path is handled in kernel and the data > > path is handled in userspace. > > > > A message mechnism is use

Re: [PATCH v14 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

2021-06-21 Thread John Garry
On 21/06/2021 11:00, Lu Baolu wrote: void iommu_set_dma_strict(bool force) {   if (force == true) iommu_dma_strict = true;  else if (!(iommu_cmd_line & IOMMU_CMD_LINE_STRICT)) iommu_dma_strict = true; } So we would use iommu_set_dma_strict(true) for a) and b), but

Re: [PATCH v14 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

2021-06-21 Thread Lu Baolu
On 2021/6/21 16:12, John Garry wrote: On 21/06/2021 06:17, Lu Baolu wrote: On 2021/6/18 19:34, John Garry wrote: diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 60b1ec42e73b..ff221d3ddcbc 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -349,10 +349,9 @@ static

Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-21 Thread Jason Wang
在 2021/6/15 下午10:13, Xie Yongji 写道: This VDUSE driver enables implementing vDPA devices in userspace. The vDPA device's control path is handled in kernel and the data path is handled in userspace. A message mechnism is used by VDUSE driver to forward some control messages such as starting/stopp

Re: [PATCH v14 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

2021-06-21 Thread John Garry
On 21/06/2021 06:17, Lu Baolu wrote: On 2021/6/18 19:34, John Garry wrote: diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 60b1ec42e73b..ff221d3ddcbc 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -349,10 +349,9 @@ static int __init iommu_dma_setup(char *str)