Re: [PATCH v3 30/38] virtio_input: convert to LE accessors
On Wed, Aug 05, 2020 at 09:44:36AM -0400, Michael S. Tsirkin wrote: > Virtio input is modern-only. Use LE accessors for config space. > > Signed-off-by: Michael S. Tsirkin Reviewed-by: Gerd Hoffmann ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH -next] vdpa: Remove duplicate include
On 2020/8/18 下午7:49, YueHaibing wrote: Remove duplicate include file Signed-off-by: YueHaibing --- drivers/vhost/vdpa.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 3fab94f88894..95e2b8307a2a 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -22,7 +22,6 @@ #include #include #include -#include #include "vhost.h" Acked-by: Jason Wang ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH -next] vdpa/mlx5: Remove duplicate include
On 2020/8/18 下午7:46, YueHaibing wrote: Remove duplicate include file Signed-off-by: YueHaibing --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 9df69d5efe8c..12fb83dc1de9 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -8,7 +8,6 @@ #include #include #include -#include #include "mlx5_vnet.h" #include "mlx5_vdpa_ifc.h" #include "mlx5_vdpa.h" Acked-by: Jason Wang ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH] drm/qxl: Fix build errors
On Tue, 18 Aug 2020 at 15:32, Gerd Hoffmann wrote: > > Hi, > > > I guess things are never quite so easy :-). It looks like Daniel's > > patch is in drm-misc-fixes and Sidong's patch is in drm-misc-next. On > > their own they're fine, but once they are merged in drm-tip the build > > error shows up. > > Ah, ok. I've already wondered how that got past my build testing. > This explains it. > > thanks for looking into it, I've fixed this in drm-tip with a fixup. In future when we find these silent conflicts, can someone please https://drm.pages.freedesktop.org/maintainer-tools/drm-tip.html follow those instructions to fix it up. Dave. ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH v8 2/2] s390: virtio: PV needs VIRTIO I/O device protection
On Tue, 18 Aug 2020 16:58:31 +0200 Pierre Morel wrote: > If protected virtualization is active on s390, the virtio queues are > not accessible to the host, unless VIRTIO_F_IOMMU_PLATFORM has been > negotiated. > Define CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS and export > arch_has_restricted_memory_access to fail probe if that's > not the case, preventing a host error on access attempt. > > Signed-off-by: Pierre Morel > --- > arch/s390/Kconfig | 1 + > arch/s390/mm/init.c | 30 ++ > 2 files changed, 31 insertions(+) > > diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig > index 9cfd8de907cb..d4a3ef4fa27b 100644 > --- a/arch/s390/Kconfig > +++ b/arch/s390/Kconfig > @@ -820,6 +820,7 @@ menu "Virtualization" > config PROTECTED_VIRTUALIZATION_GUEST > def_bool n > prompt "Protected virtualization guest support" > + select ARCH_HAS_RESTRICTED_MEMORY_ACCESS > help > Select this option, if you want to be able to run this > kernel as a protected virtualization KVM guest. > diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c > index 6dc7c3b60ef6..aec04d7dd089 100644 > --- a/arch/s390/mm/init.c > +++ b/arch/s390/mm/init.c > @@ -45,6 +45,7 @@ > #include > #include > #include > +#include > > pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir); > > @@ -161,6 +162,35 @@ bool force_dma_unencrypted(struct device *dev) > return is_prot_virt_guest(); > } > > +#ifdef CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS > +/* > + * arch_has_restricted_memory_access > + * @dev: the VIRTIO device being added > + * > + * Return an error if required features are missing on a guest running > + * with protected virtualization. > + */ > +int arch_has_restricted_memory_access(struct virtio_device *dev) > +{ > + if (!is_prot_virt_guest()) > + return 0; If you just did a return is_prot_virt_guest(); and did the virtio feature stuff in the virtio core, this function would be short and sweet :) > + > + if (!virtio_has_feature(dev, VIRTIO_F_VERSION_1)) { > + dev_warn(&dev->dev, "device must provide VIRTIO_F_VERSION_1\n"); > + return -ENODEV; > + } > + > + if (!virtio_has_feature(dev, VIRTIO_F_IOMMU_PLATFORM)) { > + dev_warn(&dev->dev, > + "device must provide VIRTIO_F_IOMMU_PLATFORM\n"); > + return -ENODEV; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(arch_has_restricted_memory_access); > +#endif > + > /* protected virtualization */ > static void pv_init(void) > { ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH v8 1/2] virtio: let arch validate VIRTIO features
On Tue, 18 Aug 2020 16:58:30 +0200 Pierre Morel wrote: > An architecture may need to validate the VIRTIO devices features > based on architecture specifics. > > Provide a new Kconfig entry, CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS, > the architecture can select when it provides a callback named > arch_has_restricted_memory_access to validate the virtio device > features. > > Signed-off-by: Pierre Morel > --- > drivers/virtio/Kconfig| 6 ++ > drivers/virtio/virtio.c | 4 > include/linux/virtio_config.h | 9 + > 3 files changed, 19 insertions(+) > > diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig > index 5809e5f5b157..eef09e3c92f9 100644 > --- a/drivers/virtio/Kconfig > +++ b/drivers/virtio/Kconfig > @@ -6,6 +6,12 @@ config VIRTIO > bus, such as CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_MMIO, CONFIG_RPMSG > or CONFIG_S390_GUEST. > > +config ARCH_HAS_RESTRICTED_MEMORY_ACCESS > + bool > + help > + This option is selected by any architecture enforcing > + VIRTIO_F_IOMMU_PLATFORM This option is only for a very specific case of "restricted memory access", namely the kind that requires IOMMU_PLATFORM for virtio devices. ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS? Or is this intended to cover cases outside of virtio as well? > + > menuconfig VIRTIO_MENU > bool "Virtio drivers" > default y > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c > index a977e32a88f2..1471db7d6510 100644 > --- a/drivers/virtio/virtio.c > +++ b/drivers/virtio/virtio.c > @@ -176,6 +176,10 @@ int virtio_finalize_features(struct virtio_device *dev) > if (ret) > return ret; > > + ret = arch_has_restricted_memory_access(dev); > + if (ret) > + return ret; Hm, I'd rather have expected something like if (arch_has_restricted_memory_access(dev)) { // enforce VERSION_1 and IOMMU_PLATFORM } Otherwise, you're duplicating the checks in the individual architecture callbacks again. [Not sure whether the device argument would be needed here; are there architectures where we'd only require IOMMU_PLATFORM for a subset of virtio devices?] > + > if (!virtio_has_feature(dev, VIRTIO_F_VERSION_1)) > return 0; > > diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h > index bb4cc4910750..f6b82541c497 100644 > --- a/include/linux/virtio_config.h > +++ b/include/linux/virtio_config.h > @@ -459,4 +459,13 @@ static inline void virtio_cwrite64(struct virtio_device > *vdev, > _r; \ > }) > > +#ifdef CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS > +int arch_has_restricted_memory_access(struct virtio_device *dev); > +#else > +static inline int arch_has_restricted_memory_access(struct virtio_device > *dev) > +{ > + return 0; > +} > +#endif /* CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS */ > + > #endif /* _LINUX_VIRTIO_CONFIG_H */ ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH V2 1/2] Add new flush_iotlb_range and handle freelists when using iommu_unmap_fast
On Tue, 18 Aug 2020 at 16:17, Robin Murphy wrote: > > On 2020-08-18 07:04, Tom Murphy wrote: > > Add a flush_iotlb_range to allow flushing of an iova range instead of a > > full flush in the dma-iommu path. > > > > Allow the iommu_unmap_fast to return newly freed page table pages and > > pass the freelist to queue_iova in the dma-iommu ops path. > > > > This patch is useful for iommu drivers (in this case the intel iommu > > driver) which need to wait for the ioTLB to be flushed before newly > > free/unmapped page table pages can be freed. This way we can still batch > > ioTLB free operations and handle the freelists. > > It sounds like the freelist is something that logically belongs in the > iommu_iotlb_gather structure. And even if it's not a perfect fit I'd be > inclined to jam it in there anyway just to avoid this giant argument > explosion ;) Good point, I'll do that. > > Why exactly do we need to introduce a new flush_iotlb_range() op? Can't > the AMD driver simply use the gather mechanism like everyone else? No, there's no reason it can't simply use the gather mechanism. I will use the gather mechanism. I think I wrote this patch way back before the gather mechanism was introduced and I've been rebasing/slightly updating it since then without paying proper attention to the code. > > Robin. > > > Change-log: > > V2: > > -fix missing parameter in mtk_iommu_v1.c > > > > Signed-off-by: Tom Murphy > > --- > > drivers/iommu/amd/iommu.c | 14 - > > drivers/iommu/arm-smmu-v3.c | 3 +- > > drivers/iommu/arm-smmu.c| 3 +- > > drivers/iommu/dma-iommu.c | 45 --- > > drivers/iommu/exynos-iommu.c| 3 +- > > drivers/iommu/intel/iommu.c | 54 + > > drivers/iommu/iommu.c | 25 +++ > > drivers/iommu/ipmmu-vmsa.c | 3 +- > > drivers/iommu/msm_iommu.c | 3 +- > > drivers/iommu/mtk_iommu.c | 3 +- > > drivers/iommu/mtk_iommu_v1.c| 3 +- > > drivers/iommu/omap-iommu.c | 3 +- > > drivers/iommu/qcom_iommu.c | 3 +- > > drivers/iommu/rockchip-iommu.c | 3 +- > > drivers/iommu/s390-iommu.c | 3 +- > > drivers/iommu/sun50i-iommu.c| 3 +- > > drivers/iommu/tegra-gart.c | 3 +- > > drivers/iommu/tegra-smmu.c | 3 +- > > drivers/iommu/virtio-iommu.c| 3 +- > > drivers/vfio/vfio_iommu_type1.c | 2 +- > > include/linux/iommu.h | 21 +++-- > > 21 files changed, 150 insertions(+), 56 deletions(-) > > > > diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c > > index 2f22326ee4df..25fbacab23c3 100644 > > --- a/drivers/iommu/amd/iommu.c > > +++ b/drivers/iommu/amd/iommu.c > > @@ -2513,7 +2513,8 @@ static int amd_iommu_map(struct iommu_domain *dom, > > unsigned long iova, > > > > static size_t amd_iommu_unmap(struct iommu_domain *dom, unsigned long > > iova, > > size_t page_size, > > - struct iommu_iotlb_gather *gather) > > + struct iommu_iotlb_gather *gather, > > + struct page **freelist) > > { > > struct protection_domain *domain = to_pdomain(dom); > > struct domain_pgtable pgtable; > > @@ -2636,6 +2637,16 @@ static void amd_iommu_flush_iotlb_all(struct > > iommu_domain *domain) > > spin_unlock_irqrestore(&dom->lock, flags); > > } > > > > +static void amd_iommu_flush_iotlb_range(struct iommu_domain *domain, > > + unsigned long iova, size_t size, > > + struct page *freelist) > > +{ > > + struct protection_domain *dom = to_pdomain(domain); > > + > > + domain_flush_pages(dom, iova, size); > > + domain_flush_complete(dom); > > +} > > + > > static void amd_iommu_iotlb_sync(struct iommu_domain *domain, > >struct iommu_iotlb_gather *gather) > > { > > @@ -2675,6 +2686,7 @@ const struct iommu_ops amd_iommu_ops = { > > .is_attach_deferred = amd_iommu_is_attach_deferred, > > .pgsize_bitmap = AMD_IOMMU_PGSIZES, > > .flush_iotlb_all = amd_iommu_flush_iotlb_all, > > + .flush_iotlb_range = amd_iommu_flush_iotlb_range, > > .iotlb_sync = amd_iommu_iotlb_sync, > > .def_domain_type = amd_iommu_def_domain_type, > > }; > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > > index f578677a5c41..8d328dc25326 100644 > > --- a/drivers/iommu/arm-smmu-v3.c > > +++ b/drivers/iommu/arm-smmu-v3.c > > @@ -2854,7 +2854,8 @@ static int arm_smmu_map(struct iommu_domain *domain, > > unsigned long iova, > > } > > > > static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long > > iova, > > - size_t size, struct iommu_iotlb_gather *gather) > > + size_t size, struct iommu_iotlb_gather *gather, > > + struct page **freelist) >
Re: [PATCH V2 1/2] Add new flush_iotlb_range and handle freelists when using iommu_unmap_fast
On 2020-08-18 07:04, Tom Murphy wrote: Add a flush_iotlb_range to allow flushing of an iova range instead of a full flush in the dma-iommu path. Allow the iommu_unmap_fast to return newly freed page table pages and pass the freelist to queue_iova in the dma-iommu ops path. This patch is useful for iommu drivers (in this case the intel iommu driver) which need to wait for the ioTLB to be flushed before newly free/unmapped page table pages can be freed. This way we can still batch ioTLB free operations and handle the freelists. It sounds like the freelist is something that logically belongs in the iommu_iotlb_gather structure. And even if it's not a perfect fit I'd be inclined to jam it in there anyway just to avoid this giant argument explosion ;) Why exactly do we need to introduce a new flush_iotlb_range() op? Can't the AMD driver simply use the gather mechanism like everyone else? Robin. Change-log: V2: -fix missing parameter in mtk_iommu_v1.c Signed-off-by: Tom Murphy --- drivers/iommu/amd/iommu.c | 14 - drivers/iommu/arm-smmu-v3.c | 3 +- drivers/iommu/arm-smmu.c| 3 +- drivers/iommu/dma-iommu.c | 45 --- drivers/iommu/exynos-iommu.c| 3 +- drivers/iommu/intel/iommu.c | 54 + drivers/iommu/iommu.c | 25 +++ drivers/iommu/ipmmu-vmsa.c | 3 +- drivers/iommu/msm_iommu.c | 3 +- drivers/iommu/mtk_iommu.c | 3 +- drivers/iommu/mtk_iommu_v1.c| 3 +- drivers/iommu/omap-iommu.c | 3 +- drivers/iommu/qcom_iommu.c | 3 +- drivers/iommu/rockchip-iommu.c | 3 +- drivers/iommu/s390-iommu.c | 3 +- drivers/iommu/sun50i-iommu.c| 3 +- drivers/iommu/tegra-gart.c | 3 +- drivers/iommu/tegra-smmu.c | 3 +- drivers/iommu/virtio-iommu.c| 3 +- drivers/vfio/vfio_iommu_type1.c | 2 +- include/linux/iommu.h | 21 +++-- 21 files changed, 150 insertions(+), 56 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 2f22326ee4df..25fbacab23c3 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -2513,7 +2513,8 @@ static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova, static size_t amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova, size_t page_size, - struct iommu_iotlb_gather *gather) + struct iommu_iotlb_gather *gather, + struct page **freelist) { struct protection_domain *domain = to_pdomain(dom); struct domain_pgtable pgtable; @@ -2636,6 +2637,16 @@ static void amd_iommu_flush_iotlb_all(struct iommu_domain *domain) spin_unlock_irqrestore(&dom->lock, flags); } +static void amd_iommu_flush_iotlb_range(struct iommu_domain *domain, + unsigned long iova, size_t size, + struct page *freelist) +{ + struct protection_domain *dom = to_pdomain(domain); + + domain_flush_pages(dom, iova, size); + domain_flush_complete(dom); +} + static void amd_iommu_iotlb_sync(struct iommu_domain *domain, struct iommu_iotlb_gather *gather) { @@ -2675,6 +2686,7 @@ const struct iommu_ops amd_iommu_ops = { .is_attach_deferred = amd_iommu_is_attach_deferred, .pgsize_bitmap = AMD_IOMMU_PGSIZES, .flush_iotlb_all = amd_iommu_flush_iotlb_all, + .flush_iotlb_range = amd_iommu_flush_iotlb_range, .iotlb_sync = amd_iommu_iotlb_sync, .def_domain_type = amd_iommu_def_domain_type, }; diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index f578677a5c41..8d328dc25326 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2854,7 +2854,8 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, } static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova, -size_t size, struct iommu_iotlb_gather *gather) +size_t size, struct iommu_iotlb_gather *gather, +struct page **freelist) { struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); struct io_pgtable_ops *ops = smmu_domain->pgtbl_ops; diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 243bc4cb2705..0cd0dfc89875 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1234,7 +1234,8 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, } static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova, -size_t size, struct iommu_iotlb_gather *gather) +size_t size, struct iommu_iotlb_gather *gather, +struct page **freel
Re: [PATCH v5 00/75] x86: SEV-ES Guest Support
Hi Mike, On Thu, Jul 30, 2020 at 11:23:50PM +, Mike Stunes wrote: > Yes, FSGSBASE was enabled. If I disable it*, this kernel boots fine, with > both CPUs online. > > *That is, by forcing guest-CPUID[7].EBX bit 0 to 0. Can you please test whether https://git.kernel.org/pub/scm/linux/kernel/git/joro/linux.git/log/?h=sev-es-client-tip-5.9 still triggers this issue on your side? Thanks, Joerg ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH v8 1/2] virtio: let arch validate VIRTIO features
An architecture may need to validate the VIRTIO devices features based on architecture specifics. Provide a new Kconfig entry, CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS, the architecture can select when it provides a callback named arch_has_restricted_memory_access to validate the virtio device features. Signed-off-by: Pierre Morel --- drivers/virtio/Kconfig| 6 ++ drivers/virtio/virtio.c | 4 include/linux/virtio_config.h | 9 + 3 files changed, 19 insertions(+) diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig index 5809e5f5b157..eef09e3c92f9 100644 --- a/drivers/virtio/Kconfig +++ b/drivers/virtio/Kconfig @@ -6,6 +6,12 @@ config VIRTIO bus, such as CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_MMIO, CONFIG_RPMSG or CONFIG_S390_GUEST. +config ARCH_HAS_RESTRICTED_MEMORY_ACCESS + bool + help + This option is selected by any architecture enforcing + VIRTIO_F_IOMMU_PLATFORM + menuconfig VIRTIO_MENU bool "Virtio drivers" default y diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index a977e32a88f2..1471db7d6510 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -176,6 +176,10 @@ int virtio_finalize_features(struct virtio_device *dev) if (ret) return ret; + ret = arch_has_restricted_memory_access(dev); + if (ret) + return ret; + if (!virtio_has_feature(dev, VIRTIO_F_VERSION_1)) return 0; diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index bb4cc4910750..f6b82541c497 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -459,4 +459,13 @@ static inline void virtio_cwrite64(struct virtio_device *vdev, _r; \ }) +#ifdef CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS +int arch_has_restricted_memory_access(struct virtio_device *dev); +#else +static inline int arch_has_restricted_memory_access(struct virtio_device *dev) +{ + return 0; +} +#endif /* CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS */ + #endif /* _LINUX_VIRTIO_CONFIG_H */ -- 2.25.1 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH v8 0/2] s390: virtio: let arch validate VIRTIO features
Hi all, The goal of the series is to give a chance to the architecture to validate VIRTIO device features. in this respin: I use the original idea from Connie for an optional arch_has_restricted_memory_access. I renamed the callback accordingly, added the definition of ARCH_HAS_RESTRICTED_MEMORY_ACCESS inside the VIRTIO Kconfig and the selection in the PROTECTED_VIRTUALIZATION_GUEST config entry. Regards, Pierre Pierre Morel (2): virtio: let arch validate VIRTIO features s390: virtio: PV needs VIRTIO I/O device protection arch/s390/Kconfig | 1 + arch/s390/mm/init.c | 30 ++ drivers/virtio/Kconfig| 6 ++ drivers/virtio/virtio.c | 4 include/linux/virtio_config.h | 9 + 5 files changed, 50 insertions(+) -- 2.25.1 Changelog to v8: - refactoring by using an optional callback (Connie) to v7: - typo in warning message (Connie) to v6: - rewording warning messages (Connie, Halil) to v5: - return directly from S390 arch_validate_virtio_features() when the guest is not protected. (Connie) - Somme rewording (Connie, Michael) - moved back code from arch/s390/ ...kernel/uv.c to ...mm/init.c (Christian) to v4: - separate virtio and arch code (Pierre) - moved code from arch/s390/mm/init.c to arch/s390/kernel/uv.c (as interpreted from Heiko's comment) - moved validation inside the arch code (Connie) - moved the call to arch validation before VIRTIO_F_1 test (Michael) to v3: - add warning (Connie, Christian) - add comment (Connie) - change hook name (Halil, Connie) to v2: - put the test in virtio_finalize_features() (Connie) - put the test inside VIRTIO core (Jason) - pass a virtio device as parameter (Halil) ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH v8 2/2] s390: virtio: PV needs VIRTIO I/O device protection
If protected virtualization is active on s390, the virtio queues are not accessible to the host, unless VIRTIO_F_IOMMU_PLATFORM has been negotiated. Define CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS and export arch_has_restricted_memory_access to fail probe if that's not the case, preventing a host error on access attempt. Signed-off-by: Pierre Morel --- arch/s390/Kconfig | 1 + arch/s390/mm/init.c | 30 ++ 2 files changed, 31 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 9cfd8de907cb..d4a3ef4fa27b 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -820,6 +820,7 @@ menu "Virtualization" config PROTECTED_VIRTUALIZATION_GUEST def_bool n prompt "Protected virtualization guest support" + select ARCH_HAS_RESTRICTED_MEMORY_ACCESS help Select this option, if you want to be able to run this kernel as a protected virtualization KVM guest. diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 6dc7c3b60ef6..aec04d7dd089 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c @@ -45,6 +45,7 @@ #include #include #include +#include pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir); @@ -161,6 +162,35 @@ bool force_dma_unencrypted(struct device *dev) return is_prot_virt_guest(); } +#ifdef CONFIG_ARCH_HAS_RESTRICTED_MEMORY_ACCESS +/* + * arch_has_restricted_memory_access + * @dev: the VIRTIO device being added + * + * Return an error if required features are missing on a guest running + * with protected virtualization. + */ +int arch_has_restricted_memory_access(struct virtio_device *dev) +{ + if (!is_prot_virt_guest()) + return 0; + + if (!virtio_has_feature(dev, VIRTIO_F_VERSION_1)) { + dev_warn(&dev->dev, "device must provide VIRTIO_F_VERSION_1\n"); + return -ENODEV; + } + + if (!virtio_has_feature(dev, VIRTIO_F_IOMMU_PLATFORM)) { + dev_warn(&dev->dev, +"device must provide VIRTIO_F_IOMMU_PLATFORM\n"); + return -ENODEV; + } + + return 0; +} +EXPORT_SYMBOL(arch_has_restricted_memory_access); +#endif + /* protected virtualization */ static void pv_init(void) { -- 2.25.1 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH -next] vdpa: Remove duplicate include
Remove duplicate include file Signed-off-by: YueHaibing --- drivers/vhost/vdpa.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 3fab94f88894..95e2b8307a2a 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -22,7 +22,6 @@ #include #include #include -#include #include "vhost.h" -- 2.17.1 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH -next] vdpa/mlx5: Remove duplicate include
Remove duplicate include file Signed-off-by: YueHaibing --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 9df69d5efe8c..12fb83dc1de9 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -8,7 +8,6 @@ #include #include #include -#include #include "mlx5_vnet.h" #include "mlx5_vdpa_ifc.h" #include "mlx5_vdpa.h" -- 2.17.1 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH v2 2/2] drm/virtio: set max_segment
When initializing call virtio_max_dma_size() to figure the scatter list limit. Needed to make virtio-gpu work properly with SEV. v2: place max_segment in drm driver not gem object. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_kms.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index bf060c69850f..5a4364c00fae 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -114,6 +114,7 @@ int virtio_gpu_init(struct drm_device *dev) vgdev->ddev = dev; dev->dev_private = vgdev; + dev->max_segment = virtio_max_dma_size(vgdev->vdev); vgdev->vdev = dev_to_virtio(dev->dev); vgdev->dev = dev->dev; -- 2.18.4 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH 2/2] drm/virtio: set max_segment
When initializing gem objects call virtio_max_dma_size() to figure the scatter list limit. Needed to make virtio-gpu work properly with SEV. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 1359eb8f1a02..26b608e2554e 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -214,6 +214,7 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, goto err_free_gem; bo->dumb = params->dumb; + shmem_obj->base.max_segment = virtio_max_dma_size(vgdev->vdev); if (fence) { ret = -ENOMEM; -- 2.18.4 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH 2/2] drm/virtio: drop virtio_gpu_output->enabled
Not needed, already tracked by drm_crtc_state->active. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_display.c | 4 drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 4ab1b0ba2925..fbc04272db4f 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -137,7 +137,6 @@ struct virtio_gpu_output { struct edid *edid; int cur_x; int cur_y; - bool enabled; bool needs_modeset; }; #define drm_crtc_to_virtio_gpu_output(x) \ diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 6c26b41f4e0d..86a3a800d12e 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -97,9 +97,6 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc) static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); - - output->enabled = true; } static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, @@ -111,7 +108,6 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0); virtio_gpu_notify(vgdev); - output->enabled = false; } static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 65757409d9ed..6a311cd93440 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -142,7 +142,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, if (WARN_ON(!output)) return; - if (!plane->state->fb || !output->enabled) { + if (!plane->state->fb || !output->crtc.state->active) { DRM_DEBUG("nofb\n"); virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, plane->state->src_w >> 16, -- 2.18.4 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH 1/2] drm/virtio: fix unblank
When going through a disable/enable cycle without changing the framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") causes the screen stay blank. Add a bool to force an update to fix that. v2: use drm_atomic_crtc_needs_modeset() (Daniel). Cc: 1882...@bugs.launchpad.net Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_display.c | 11 +++ drivers/gpu/drm/virtio/virtgpu_plane.c | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 9ff9f4ac0522..4ab1b0ba2925 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -138,6 +138,7 @@ struct virtio_gpu_output { int cur_x; int cur_y; bool enabled; + bool needs_modeset; }; #define drm_crtc_to_virtio_gpu_output(x) \ container_of(x, struct virtio_gpu_output, crtc) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 2c2742b8d657..6c26b41f4e0d 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -123,6 +123,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { + struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); + + /* +* virtio-gpu can't do modeset and plane update operations +* independant from each other. So the actual modeset happens +* in the plane update callback, and here we just check +* whenever we must force the modeset. +*/ + if (drm_atomic_crtc_needs_modeset(crtc->state)) { + output->needs_modeset = true; + } } static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 52d24179bcec..65757409d9ed 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, plane->state->src_w != old_state->src_w || plane->state->src_h != old_state->src_h || plane->state->src_x != old_state->src_x || - plane->state->src_y != old_state->src_y) { + plane->state->src_y != old_state->src_y || + output->needs_modeset) { + output->needs_modeset = false; DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", bo->hw_res_handle, plane->state->crtc_w, plane->state->crtc_h, -- 2.18.4 ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization