Re: [PATCH 42/44] powerpc/cell: use the dma_supported method for ops switching
On Fri, 2017-06-16 at 20:10 +0200, Christoph Hellwig wrote: > Besides removing the last instance of the set_dma_mask method this also > reduced the code duplication. What is your rationale here ? (I have missed patch 0 it seems). dma_supported() was supposed to be pretty much a "const" function simply informing whether a given setup is possible. Having it perform an actual switch of ops seems to be pushing it... What if a driver wants to test various dma masks and then pick one ? Where does the API documents that if a driver calls dma_supported() it then *must* set the corresponding mask and use that ? I don't like a function that is a "boolean query" like this one to have such a major side effect. >From an API standpoint, dma_set_mask() is when the mask is established, and thus when the ops switch should happen. Ben. > Signed-off-by: Christoph Hellwig> --- > arch/powerpc/platforms/cell/iommu.c | 25 + > 1 file changed, 9 insertions(+), 16 deletions(-) > > diff --git a/arch/powerpc/platforms/cell/iommu.c > b/arch/powerpc/platforms/cell/iommu.c > index 497bfbdbd967..29d4f96ed33e 100644 > --- a/arch/powerpc/platforms/cell/iommu.c > +++ b/arch/powerpc/platforms/cell/iommu.c > @@ -644,20 +644,14 @@ static void dma_fixed_unmap_sg(struct device *dev, > struct scatterlist *sg, > direction, attrs); > } > > -static int dma_fixed_dma_supported(struct device *dev, u64 mask) > -{ > - return mask == DMA_BIT_MASK(64); > -} > - > -static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask); > +static int dma_suported_and_switch(struct device *dev, u64 dma_mask); > > static const struct dma_map_ops dma_iommu_fixed_ops = { > .alloc = dma_fixed_alloc_coherent, > .free = dma_fixed_free_coherent, > .map_sg = dma_fixed_map_sg, > .unmap_sg = dma_fixed_unmap_sg, > - .dma_supported = dma_fixed_dma_supported, > - .set_dma_mask = dma_set_mask_and_switch, > + .dma_supported = dma_suported_and_switch, > .map_page = dma_fixed_map_page, > .unmap_page = dma_fixed_unmap_page, > .mapping_error = dma_iommu_mapping_error, > @@ -952,11 +946,8 @@ static u64 cell_iommu_get_fixed_address(struct device > *dev) > return dev_addr; > } > > -static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask) > +static int dma_suported_and_switch(struct device *dev, u64 dma_mask) > { > - if (!dev->dma_mask || !dma_supported(dev, dma_mask)) > - return -EIO; > - > if (dma_mask == DMA_BIT_MASK(64) && > cell_iommu_get_fixed_address(dev) != OF_BAD_ADDR) { > u64 addr = cell_iommu_get_fixed_address(dev) + > @@ -965,14 +956,16 @@ static int dma_set_mask_and_switch(struct device *dev, > u64 dma_mask) > dev_dbg(dev, "iommu: fixed addr = %llx\n", addr); > set_dma_ops(dev, _iommu_fixed_ops); > set_dma_offset(dev, addr); > - } else { > + return 1; > + } > + > + if (dma_iommu_dma_supported(dev, dma_mask)) { > dev_dbg(dev, "iommu: not 64-bit, using default ops\n"); > set_dma_ops(dev, get_pci_dma_ops()); > cell_dma_dev_setup(dev); > + return 1; > } > > - *dev->dma_mask = dma_mask; > - > return 0; > } > > @@ -1127,7 +1120,7 @@ static int __init cell_iommu_fixed_mapping_init(void) > cell_iommu_setup_window(iommu, np, dbase, dsize, 0); > } > > - dma_iommu_ops.set_dma_mask = dma_set_mask_and_switch; > + dma_iommu_ops.dma_supported = dma_suported_and_switch; > set_pci_dma_ops(_iommu_ops); > > return 0; ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH v7 29/36] x86, drm, fbdev: Do not specify encrypted memory for video mappings
Hi Tom, [auto build test ERROR on next-20170616] [cannot apply to tip/x86/core linus/master linux/master v4.9-rc8 v4.9-rc7 v4.9-rc6 v4.12-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Tom-Lendacky/x86-Secure-Memory-Encryption-AMD/20170617-210824 config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=sh All errors (new ones prefixed by >>): drivers/gpu/drm/drm_gem.c: In function 'drm_gem_mmap_obj': >> drivers/gpu/drm/drm_gem.c:932:22: error: implicit declaration of function >> 'pgprot_decrypted' [-Werror=implicit-function-declaration] vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); ^~~~ >> drivers/gpu/drm/drm_gem.c:932:20: error: incompatible types when assigning >> to type 'pgprot_t {aka struct }' from type 'int' vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); ^ cc1: some warnings being treated as errors -- drivers/video/fbdev/core/fbmem.c: In function 'fb_mmap': >> drivers/video/fbdev/core/fbmem.c:1414:23: error: implicit declaration of >> function 'pgprot_decrypted' [-Werror=implicit-function-declaration] vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); ^~~~ >> drivers/video/fbdev/core/fbmem.c:1414:21: error: incompatible types when >> assigning to type 'pgprot_t {aka struct }' from type 'int' vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); ^ drivers/video/fbdev/core/fbmem.c:1444:20: error: incompatible types when assigning to type 'pgprot_t {aka struct }' from type 'int' vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); ^ cc1: some warnings being treated as errors -- drivers/gpu/drm/udl/udl_fb.c: In function 'udl_fb_mmap': >> drivers/gpu/drm/udl/udl_fb.c:174:22: error: implicit declaration of function >> 'pgprot_decrypted' [-Werror=implicit-function-declaration] vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); ^~~~ >> drivers/gpu/drm/udl/udl_fb.c:174:20: error: incompatible types when >> assigning to type 'pgprot_t {aka struct }' from type 'int' vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); ^ cc1: some warnings being treated as errors vim +/pgprot_decrypted +932 drivers/gpu/drm/drm_gem.c 926 return -EINVAL; 927 928 vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP; 929 vma->vm_ops = dev->driver->gem_vm_ops; 930 vma->vm_private_data = obj; 931 vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); > 932 vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); 933 934 /* Take a ref for this mapping of the object, so that the fault 935 * handler can dereference the mmap offset's pointer to the object. --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH v7 32/36] xen/x86: Remove SME feature in PV guests
On 16/06/17 20:55, Tom Lendacky wrote: > Xen does not currently support SME for PV guests. Clear the SME cpu > capability in order to avoid any ambiguity. > > Signed-off-by: Tom LendackyReviewed-by: Juergen Gross Juergen > --- > arch/x86/xen/enlighten_pv.c |1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c > index f33eef4..e6ecf42 100644 > --- a/arch/x86/xen/enlighten_pv.c > +++ b/arch/x86/xen/enlighten_pv.c > @@ -294,6 +294,7 @@ static void __init xen_init_capabilities(void) > setup_clear_cpu_cap(X86_FEATURE_MTRR); > setup_clear_cpu_cap(X86_FEATURE_ACC); > setup_clear_cpu_cap(X86_FEATURE_X2APIC); > + setup_clear_cpu_cap(X86_FEATURE_SME); > > if (!xen_initial_domain()) > setup_clear_cpu_cap(X86_FEATURE_ACPI); > > ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu