Re: [PATCH 3/3] powerpc/mm/hash: Avoid multiple HPT resize-downs on memory hotunplug

2021-04-18 Thread David Gibson
On Fri, Apr 09, 2021 at 12:31:03AM -0300, Leonardo Bras wrote: > Hello David, thanks for commenting. > > On Tue, 2021-03-23 at 10:45 +1100, David Gibson wrote: > > > @@ -805,6 +808,10 @@ static int resize_hpt_for_hotplug(unsigned long > > > new_mem_size, bool shrin

Re: [PATCH 2/3] powerpc/mm/hash: Avoid multiple HPT resize-ups on memory hotplug

2021-04-18 Thread David Gibson
On Thu, Apr 08, 2021 at 11:51:36PM -0300, Leonardo Bras wrote: > Hello David, thanks for the feedback! > > On Mon, 2021-03-22 at 18:55 +1100, David Gibson wrote: > > > +void hash_memory_batch_expand_prepare(unsigned long newsize) > > > +{ > > > + /* > >

Re: [PATCH] vfio/pci: Add missing range check in vfio_pci_mmap

2021-04-12 Thread David Gibson
vger.kernel.org > Signed-off-by: Christian A. Ehrhardt Reviewed-by: David Gibson > --- > drivers/vfio/pci/vfio_pci.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c > index 65e7e6b44578..5023e2

Re: [PATCH 3/3] powerpc/mm/hash: Avoid multiple HPT resize-downs on memory hotunplug

2021-03-22 Thread David Gibson
rc = -EINVAL; > } else { > for_each_drmem_lmb(lmb) { > @@ -814,6 +828,7 @@ static int dlpar_memory_add_by_ic(u32 lmbs_to_add, u32 > drc_index) > if (rc) { > pr_err("Memory indexed-count-add failed, removing any added > LMBs\n"); >

Re: [PATCH 2/3] powerpc/mm/hash: Avoid multiple HPT resize-ups on memory hotplug

2021-03-22 Thread David Gibson
urn -EINVAL; > > + memory_batch_expand_prepare(memblock_phys_mem_size() + lmbs_to_add * > drmem_lmb_size()); > + > for_each_drmem_lmb_in_range(lmb, start_lmb, end_lmb) { > if (lmb->flags & DRCONF_MEM_ASSIGNED) >

Re: [PATCH 1/3] powerpc/mm/hash: Avoid resizing-down HPT on first memory hotplug

2021-03-22 Thread David Gibson
ong end) > int rc = htab_remove_mapping(start, end, mmu_linear_psize, > mmu_kernel_ssize); > > - if (resize_hpt_for_hotplug(memblock_phys_mem_size()) == -ENOSPC) > + if (resize_hpt_for_hotplug(memblock_phys_mem_size(), true) == -ENO

Re: [PATCH V4 0/3] scripts: dtc: Build fdtoverlay

2021-02-21 Thread David Gibson
On Thu, Feb 04, 2021 at 08:25:23AM -0600, Rob Herring wrote: > On Sun, Jan 31, 2021 at 10:39 PM David Gibson > wrote: > > > > On Mon, Jan 25, 2021 at 09:42:21PM -0600, Frank Rowand wrote: > > > Hi David, > > > > > > On 1/22/21 12:34 AM, David Gibson

Re: [PATCH V7 4/6] kbuild: Add support to build overlays (%.dtbo)

2021-02-05 Thread David Gibson
hange in the DTC compiler. Not really. It would need a change to automatically recognize that extension, but you can easily work around that by explicitly giving the -I option to specify the input type. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dro

Re: [PATCH V4 0/3] scripts: dtc: Build fdtoverlay

2021-01-31 Thread David Gibson
On Mon, Jan 25, 2021 at 09:42:21PM -0600, Frank Rowand wrote: > Hi David, > > On 1/22/21 12:34 AM, David Gibson wrote: > > On Wed, Jan 20, 2021 at 10:47:40AM +0530, Viresh Kumar wrote: > >> +David. > >> > >> On 19-01-21, 11:12, Frank Rowand wrote: &g

Re: [PATCH V6 5/6] of: unittest: Create overlay_common.dtsi and testcases_common.dtsi

2021-01-22 Thread David Gibson
t really looks like the unittest stuff is doing some very bogus stuff that should be fixed first, before trying to do this on top. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_

Re: [PATCH V6 2/6] scripts: dtc: Build fdtoverlay tool

2021-01-22 Thread David Gibson
_empty_tree.o fdt_addresses.o fdt_overlay.o > +libfdt = $(addprefix libfdt/,$(libfdt-objs)) > +fdtoverlay-objs := $(libfdt) fdtoverlay.o util.o > + > # Source files need to get at the userspace version of libfdt_env.h to > compile > HOST_EXTRACFLAGS += -I $(srctree)/$(src)

Re: [PATCH V4 0/3] scripts: dtc: Build fdtoverlay

2021-01-21 Thread David Gibson
vailable. Of course it would be possible to write a friendly command line tool specifically for applying overlays, which could give better errors. fdtoverlay as it stands isn't really that - it was pretty much written just to invoke fdt_overlay_apply() in testcases. > > fdtoverlay in it's

Re: [PATCH V5 5/5] of: unittest: Statically apply overlays using fdtoverlay

2021-01-21 Thread David Gibson
On Fri, Jan 22, 2021 at 08:40:49AM +0530, Viresh Kumar wrote: > On 22-01-21, 10:39, David Gibson wrote: > > No, it definitely will not work in general. It might kinda work in a > > few trivial cases, but it absolutely will not do the neccessary > > handling in some cases. &

Re: [PATCH V5 5/5] of: unittest: Statically apply overlays using fdtoverlay

2021-01-21 Thread David Gibson
On Thu, Jan 21, 2021 at 12:27:28PM +0530, Viresh Kumar wrote: > On 21-01-21, 17:34, David Gibson wrote: > > No, this is the wrong way around. The expected operation here is that > > you apply overlay (1) to the base tree, giving you, say, output1.dtb. > > output1.dtb is (eff

Re: [PATCH V5 5/5] of: unittest: Statically apply overlays using fdtoverlay

2021-01-21 Thread David Gibson
se tree or an overlay. I'm still not seeing any reasonable use for the plugin version either, fwiw. > > 4) create a new file overlay_base_static.dts: >// SPDX-License-Identifier: GPL-2.0 > /dts-v1/; >#include overlay_base_dtsi > > 5) then use overlay_b

Re: [PATCH V5 5/5] of: unittest: Statically apply overlays using fdtoverlay

2021-01-20 Thread David Gibson
hack to see if the method might work). So I > >> would > >> have to set things up properly to really test this. > >> > >> If this does work, it would remove my objections to you trying to transform > >> the existing unittest .dts test data files (becaus

Re: [PATCH] of: unittest: Statically apply overlays using fdtoverlay

2021-01-20 Thread David Gibson
knowledgeable people look at the contents of some of the > .dts test data files and think that they are incorrect. That is because > the way that unittest uses them is not normal. Trying to modify one or two > of the many unittest .dts test data files so that they are usable by both >

Re: [PATCH V5 4/5] kbuild: Add support to build overlays (%.dtbo)

2021-01-20 Thread David Gibson
On Thu, Jan 21, 2021 at 09:43:00AM +0530, Viresh Kumar wrote: > On 21-01-21, 11:49, David Gibson wrote: > > If you're using overlays, you probably need the -@ flag, for both the > > base file and the overlays, which AFAICT is not already the case. > > I thi

Re: [PATCH V5 5/5] of: unittest: Statically apply overlays using fdtoverlay

2021-01-20 Thread David Gibson
to it. However, a dtbo is a weirdly structured dtb, so applying an overlay to it is very unlikely to give you something useful. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_

Re: [PATCH V5 5/5] of: unittest: Statically apply overlays using fdtoverlay

2021-01-20 Thread David Gibson
effect applied to base.dtb as (1) and (2) applied in sequence. Merging overlays is something that could make sense, but fdtoverlay will not do it at present. > This is very similar to what I tried with the intermediate.dtb > earlier. > -- David Gibson| I'll have my

Re: [PATCH V5 3/5] scripts: dtc: Remove the unused fdtdump.c file

2021-01-20 Thread David Gibson
On Thu, Jan 21, 2021 at 09:47:57AM +0530, Viresh Kumar wrote: > On 21-01-21, 11:44, David Gibson wrote: > > On Wed, Jan 20, 2021 at 12:36:45PM +0530, Viresh Kumar wrote: > > > This was copied from external DTC repository long back and isn't used > > > anymore. Over th

Re: [PATCH V5 4/5] kbuild: Add support to build overlays (%.dtbo)

2021-01-20 Thread David Gibson
> assembler-with-cpp -o $(dtc-tmp) $< ; > -d $(depfile).dtc.tmp $(dtc-tmp) ; \ > cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) > > -$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE > +$(obj)/%.dtb $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE > $(

Re: [PATCH V5 5/5] of: unittest: Statically apply overlays using fdtoverlay

2021-01-20 Thread David Gibson
gpio_04b.dtb > + > +quiet_cmd_fdtoverlay = FDTOVERLAY $@ > + cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $^ > + > +$(obj)/static_test.dtb: $(obj)/testcases.dtb $(addprefix > $(obj)/,$(apply_static_overlay)) > + $(call if_changed,fdtoverlay) > + >

Re: [PATCH V5 3/5] scripts: dtc: Remove the unused fdtdump.c file

2021-01-20 Thread David Gibson
quot;, depth * shift, ""); > - continue; > - } > - > - if (tag != FDT_PROP) { > - fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", depth * > shift, "", tag); > - break; >

Re: [PATCH] of: unittest: Statically apply overlays using fdtoverlay

2021-01-17 Thread David Gibson
overlay_gpio_02b.dtb overlay_gpio_03.dtb \ >overlay_gpio_04a.dtb overlay_gpio_04b.dtb \ > - intermediate-overlay.dtb > + overlay_base.dtb overlay.dtb > > quiet_cmd_fdt

Re: [PATCH] dtc: Allow overlays to have .dtbo extension

2021-01-11 Thread David Gibson
;; > return fallback; > @@ -357,6 +359,8 @@ int main(int argc, char *argv[]) > #endif > } else if (streq(outform, "dtb")) { > dt_to_blob(outf, dti, outversion); > + } else if (streq(outform, "dtbo")) { > + dt_to_blob(ou

[PATCH] powerpc: kvm: Increase HDEC threshold to enter guest

2020-08-10 Thread David Gibson
in this area. I'm still trying to determine what the cause of that difference is, but I think it's worth applying this change as a precaution in the interim. Signed-off-by: David Gibson --- arch/powerpc/kvm/book3s_hv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch

Re: [PATCH v4 0/2] dtc: Improve checks for i2c reg properties

2020-06-22 Thread David Gibson
ins a second patch to check for 10 bit vs 7 bit addresses. > > Joel Stanley (2): > checks: Remove warning for I2C_OWN_SLAVE_ADDRESS > checks: Improve i2c reg property checking > > checks.c | 14 -- > 1 file changed, 12 insertions(+), 2 deletions(-) > -- Davi

[PATCHv2] tpm: ibmvtpm: Wait for ready buffer before probing for TPM2 attributes

2020-06-18 Thread David Gibson
: 18b3670d79ae9 ("tpm: ibmvtpm: Add support for TPM2") Signed-off-by: David Gibson --- Changes from v1: * Fixed a formatting error in the commit message * Added some more detail to the commit message drivers/char/tpm/tpm_ibmvtpm.c | 14 +++--- 1 file changed, 7 insert

[PATCH] tpm: ibmvtpm: Wait for ready buffer before probing for TPM2 attributes

2020-06-05 Thread David Gibson
/ TPM implementation doesn't respond quickly enough. I find it fails almost every time with an 8 vcpu guest under KVM with software emulated TPM. Fixes: 18b3670d79ae9 "tpm: ibmvtpm: Add support for TPM2" Signed-off-by: David Gibson --- drivers/char/tpm/tpm_ibmvtpm.c | 14 +++-

Re: [PATCH v3 2/2] checks: Improve i2c reg property checking

2020-06-04 Thread David Gibson
I know it seems trivial, but I'm a bit flat out right now. Can you please resend with the 1U fix applied. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ |

Re: SPDX conversion under scripts/dtc/ of Linux Kernel

2019-06-20 Thread David Gibson
The policy is everything > is upstream first and any changes to dtc in the kernel are rejected. > > > > > > > What shall we do? > > > > > > [1] Convert upstream DTC to SPDX > > > > > > This will be a happy solution if it is acceptable in DTC

Re: [PATCH] powerpc/mm: move warning from resize_hpt_for_hotplug()

2019-03-07 Thread David Gibson
> return ret; > } > diff --git a/arch/powerpc/platforms/pseries/lpar.c > b/arch/powerpc/platforms/pseries/lpar.c > index f2a9f0adc2d3..b407034a80ba 100644 > --- a/arch/powerpc/platforms/pseries/lpar.c > +++ b/arch/powerpc/platforms/pseries/lpar.c > @@ -918,7 +918,6 @@ st

Re: [PATCH v2] powerpc/mm: move a KERN_WARNING message to pr_debug()

2019-02-06 Thread David Gibson
c != -ENODEV)) > - printk(KERN_WARNING > -"Unable to resize hash page table to target > order %d: %d\n", > -target_hpt_shift, rc); > + if (rc) > + pr_debug("Unabl

Re: [PATCH V6 0/4] mm/kvm/vfio/ppc64: Migrate compound pages out of CMA region

2019-01-10 Thread David Gibson
is that we need a substantial CMA allocation every time we start a (POWER8) guest for the HPT. It's the fact that running guests on a system both means we need the CMA unfragment and (with vfio added in) can cause CMA fragmentation which makes this particularly problematic. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson signature.asc Description: PGP signature

Re: [PATCH] PCI: Add no-D3 quirk for Mellanox ConnectX-[45]

2019-01-08 Thread David Gibson
doing something > not quite right, but we don't know what. We might need to engage > Mellanox themselves. Possibly. On the other hand, I've had it reported that this is a software regression at least with downstream red hat kernels. I haven't yet been able to eliminate factors that might

Re: [PATCH] PCI: Add no-D3 quirk for Mellanox ConnectX-[45]

2019-01-03 Thread David Gibson
On Thu, Dec 06, 2018 at 08:45:09AM +0200, Leon Romanovsky wrote: > On Thu, Dec 06, 2018 at 03:19:51PM +1100, David Gibson wrote: > > Mellanox ConnectX-5 IB cards (MT27800) seem to cause a call trace when > > unbound from their regular driver and attached to vfio-pci in order t

Re: [PATCH] PCI: Add no-D3 quirk for Mellanox ConnectX-[45]

2018-12-11 Thread David Gibson
any > behavior), and 2) add the ConnectX devices to the quirk. That way > the ConnectX change is smaller and more easily > understood/reverted/etc. Sure. Would it make sense to send (1) as an independent cleanup, while I'm still working out exactly what (if anything) we need fo

Re: [PATCH] PCI: Add no-D3 quirk for Mellanox ConnectX-[45]

2018-12-10 Thread David Gibson
On Thu, Dec 06, 2018 at 08:45:09AM +0200, Leon Romanovsky wrote: > On Thu, Dec 06, 2018 at 03:19:51PM +1100, David Gibson wrote: > > Mellanox ConnectX-5 IB cards (MT27800) seem to cause a call trace when > > unbound from their regular driver and attached to vfio-pci in order t

Re: [PATCH v4] drivers/vfio: Fix a redundant copy bug

2018-11-18 Thread David Gibson
end = offsetofend(struct vfio_eeh_pe_op, > > > err.mask); > > > + if (op.argsz < end) > > > return -EINVAL; > > > - if (copy_from_user(, (void __user *)arg, > >

Re: [PATCH v4] drivers/vfio: Fix a redundant copy bug

2018-11-18 Thread David Gibson
end = offsetofend(struct vfio_eeh_pe_op, > > > err.mask); > > > + if (op.argsz < end) > > > return -EINVAL; > > > - if (copy_from_user(, (void __user *)arg, > >

Re: Portable DT Connectors with regard to FPGAs

2018-09-24 Thread David Gibson
ty mapping or otherwise). > > Alan > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/fpga/fpga-region.txt > > [2] https://lkml.org/lkml/2016/7/20/560 > -- David Gibson| I'll have my musi

Re: Portable DT Connectors with regard to FPGAs

2018-09-24 Thread David Gibson
ty mapping or otherwise). > > Alan > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/fpga/fpga-region.txt > > [2] https://lkml.org/lkml/2016/7/20/560 > -- David Gibson| I'll have my musi

Re: [PATCH] vfio-pci: Disable binding to PFs with SR-IOV enabled

2018-07-12 Thread David Gibson
re simply refuse to bind to PFs with SR-IOV enabled > with a warning message indicating the issue. Users can resolve this > by re-binding to the host driver and disabling SR-IOV before > attempting to use the device with vfio-pci. > > Signed-off-by: Alex Williamson Reviewed-by: D

Re: [PATCH] vfio-pci: Disable binding to PFs with SR-IOV enabled

2018-07-12 Thread David Gibson
re simply refuse to bind to PFs with SR-IOV enabled > with a warning message indicating the issue. Users can resolve this > by re-binding to the host driver and disabling SR-IOV before > attempting to use the device with vfio-pci. > > Signed-off-by: Alex Williamson Reviewed-by: D

Re: [PATCH] powerpc/pseries: include linux/types.h in asm/hvcall.h

2018-01-15 Thread David Gibson
; --- > > arch/powerpc/include/asm/hvcall.h | 1 + > > 1 file changed, 1 insertion(+) > > Thanks. None of my ~250 defconfig test builds hit this, what config are > you using? I also hit this, but only when I backported the change to RH's 3.10 kernel. I assumed something s

Re: [PATCH] powerpc/pseries: include linux/types.h in asm/hvcall.h

2018-01-15 Thread David Gibson
| 1 + > > 1 file changed, 1 insertion(+) > > Thanks. None of my ~250 defconfig test builds hit this, what config are > you using? I also hit this, but only when I backported the change to RH's 3.10 kernel. I assumed something since then had added an indirect include. -

[PATCH] KVM: PPC: Book3S HV: Always flush TLB in kvmppc_alloc_reset_hpt()

2018-01-09 Thread David Gibson
. Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) Paul, this is based on Paolo's KVM tree, but it should apply without modification to pretty much any vaguely current tree. It's a

[PATCH] KVM: PPC: Book3S HV: Always flush TLB in kvmppc_alloc_reset_hpt()

2018-01-09 Thread David Gibson
. Signed-off-by: David Gibson --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) Paul, this is based on Paolo's KVM tree, but it should apply without modification to pretty much any vaguely current tree. It's a pretty nasty bug - the case we've

Re: [PATCH 0/4] Fix use after free in HPT resizing code and related minor improvements

2017-12-03 Thread David Gibson
p of the revised patches and post those separately (as a cleanup with less urgency than the actual fix). A couple of people have also suggested CCing k...@vger.kernel.org on the next round in addition to the lists already included. -- David Gibson| I'll have my music b

Re: [PATCH 0/4] Fix use after free in HPT resizing code and related minor improvements

2017-12-03 Thread David Gibson
p of the revised patches and post those separately (as a cleanup with less urgency than the actual fix). A couple of people have also suggested CCing k...@vger.kernel.org on the next round in addition to the lists already included. -- David Gibson| I'll have my music b

[PATCH] Revert "powerpc: Do not call ppc_md.panic in fadump panic notifier"

2017-12-03 Thread David Gibson
, revert it for now until we figure out how to do it properly. Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> --- arch/powerpc/include/asm/machdep.h | 1 + arch/powerpc/include/asm/setup.h | 1 + arch/powerpc/kernel/fadump.c | 22 -- arch/p

[PATCH] Revert "powerpc: Do not call ppc_md.panic in fadump panic notifier"

2017-12-03 Thread David Gibson
, revert it for now until we figure out how to do it properly. Signed-off-by: David Gibson --- arch/powerpc/include/asm/machdep.h | 1 + arch/powerpc/include/asm/setup.h | 1 + arch/powerpc/kernel/fadump.c | 22 -- arch/powerpc/kernel/setup-common.c | 27

Re: [PATCH 4/4] KVM: PPC: Book3S HV: Remove redundant parameter from resize_hpt_release()

2017-11-29 Thread David Gibson
ce > associated with resize structure we going to release. > > Also kill check for resize being NULL to make code > simpler and we called with resize != NULL in all > places except kvm_vm_ioctl_resize_hpt_commit(). > > Signed-off-by: Serhii Popovych <spopo...@red

Re: [PATCH 0/4] Fix use after free in HPT resizing code and related minor improvements

2017-11-29 Thread David Gibson
1 file changed, 82 insertions(+), 57 deletions(-) Paul, these (at least 1-3) fix (another :() host crash bug which can be triggered by guest and/or userspace actions. Please merge ASAP. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au |

Re: [PATCH 3/4] KVM: PPC: Book3S HV: Fix use after free in case of multiple resize requests

2017-11-29 Thread David Gibson
35.280587] [c007e9183ce0] [c0114250] worker_thread+0x1a0/0x520 > [ 635.280655] [c007e9183d80] [c012010c] kthread+0xec/0x100 > [ 635.280724] [c007e9183e30] [c000a4b8] > ret_from_kernel_thread+0x5c/0xa4 > [ 635.280814] Instruction dump: >

Re: [PATCH 4/4] KVM: PPC: Book3S HV: Remove redundant parameter from resize_hpt_release()

2017-11-29 Thread David Gibson
ce > associated with resize structure we going to release. > > Also kill check for resize being NULL to make code > simpler and we called with resize != NULL in all > places except kvm_vm_ioctl_resize_hpt_commit(). > > Signed-off-by: Serhii Popovych Reviewed-by: Davi

Re: [PATCH 0/4] Fix use after free in HPT resizing code and related minor improvements

2017-11-29 Thread David Gibson
1 file changed, 82 insertions(+), 57 deletions(-) Paul, these (at least 1-3) fix (another :() host crash bug which can be triggered by guest and/or userspace actions. Please merge ASAP. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au |

Re: [PATCH 3/4] KVM: PPC: Book3S HV: Fix use after free in case of multiple resize requests

2017-11-29 Thread David Gibson
3ce0] [c0114250] worker_thread+0x1a0/0x520 > [ 635.280655] [c007e9183d80] [c012010c] kthread+0xec/0x100 > [ 635.280724] [c007e9183e30] [c000a4b8] > ret_from_kernel_thread+0x5c/0xa4 > [ 635.280814] Instruction dump: > [ 635.2

Re: [PATCH 2/4] KVM: PPC: Book3S HV: Improve kvmppc_allocate_hpt()/kvmppc_free_hpt()

2017-11-29 Thread David Gibson
r !hpt if allocated from CMA: neither > pfn_to_kaddr() nor page_to_pfn() is 0 in case of page != NULL. > > Signed-off-by: Serhii Popovych <spopo...@redhat.com> Reviewed-by: David Gibson <da...@gibson.dropbear.id.au> > --- > arch/powerpc/kvm/book3s_64_mmu_hv.c | 54

Re: [PATCH 2/4] KVM: PPC: Book3S HV: Improve kvmppc_allocate_hpt()/kvmppc_free_hpt()

2017-11-29 Thread David Gibson
r !hpt if allocated from CMA: neither > pfn_to_kaddr() nor page_to_pfn() is 0 in case of page != NULL. > > Signed-off-by: Serhii Popovych Reviewed-by: David Gibson > --- > arch/powerpc/kvm/book3s_64_mmu_hv.c | 54 > ++--- >

Re: [PATCH 1/4] KVM: PPC: Book3S HV: Drop prepare_done from struct kvm_resize_hpt and cleanups

2017-11-29 Thread David Gibson
resize_hpt_allocate() > returns -EBUSY that is treated specially. > > Change comparison against zero to make checkpatch.pl happy. > > Signed-off-by: Serhii Popovych <spopo...@redhat.com> Reviewed-by: David Gibson <da...@gibson.dro

Re: [PATCH 1/4] KVM: PPC: Book3S HV: Drop prepare_done from struct kvm_resize_hpt and cleanups

2017-11-29 Thread David Gibson
resize_hpt_allocate() > returns -EBUSY that is treated specially. > > Change comparison against zero to make checkpatch.pl happy. > > Signed-off-by: Serhii Popovych Reviewed-by: David Gibson > --- > arch/powerpc/kvm/book3s_64_mmu_hv.c | 42 > ++--

Re: [PATCH 3/5] powerpc-pseries: Delete an unnecessary variable initialisation in iommu_pseries_alloc_group()

2017-10-19 Thread David Gibson
alone is a reason not to initiaize locals if they don't require it. > You might imagine that static analysis tools would catch NULL > dereferences but it's actually really really hard. We used to have > an __uninitialized_var() macro which was used to silence GCC false > positives, but n

Re: [PATCH 3/5] powerpc-pseries: Delete an unnecessary variable initialisation in iommu_pseries_alloc_group()

2017-10-19 Thread David Gibson
ools would catch NULL > dereferences but it's actually really really hard. We used to have > an __uninitialized_var() macro which was used to silence GCC false > positives, but now we initialize the pointers to NULL instead. So > most of the code that you're dealing with is stuff that was

Re: dtc issue with overlays starting in next-20171009

2017-10-18 Thread David Gibson
ng requires information from the base tree, there is indeed not much that can be done. > > You can avoid the problem in your example dts with > > "-Wno-interrupts_property" > > > > dtc -Wno-interrupts_property fpga_01_a.dts > > > > The larger set of other checks that might trigger the assert is too large > > for me to want to add "-Wno-" flags for all of them to the command line > > (as temporary workarounds). > > David thought more switches were better. Right, as a rule, I like fine configurability of the checks. But.. there's a trick to make things easier to configure in batches: when you enable a warning, you automatically enable all warnings that warning has as prerequisites. And when you disable a warning, every other warning that has it as a prerequisite is also disabled. So by adding some dummy checks with the right depencies, you can allow enabling and disabling of groups of related checks with a single command line option. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson signature.asc Description: PGP signature

Re: dtc issue with overlays starting in next-20171009

2017-10-18 Thread David Gibson
om the base tree, there is indeed not much that can be done. > > You can avoid the problem in your example dts with > > "-Wno-interrupts_property" > > > > dtc -Wno-interrupts_property fpga_01_a.dts > > > > The larger set of other checks that might trigger the assert is too large > > for me to want to add "-Wno-" flags for all of them to the command line > > (as temporary workarounds). > > David thought more switches were better. Right, as a rule, I like fine configurability of the checks. But.. there's a trick to make things easier to configure in batches: when you enable a warning, you automatically enable all warnings that warning has as prerequisites. And when you disable a warning, every other warning that has it as a prerequisite is also disabled. So by adding some dummy checks with the right depencies, you can allow enabling and disabling of groups of related checks with a single command line option. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson signature.asc Description: PGP signature

Re: dtc issue with overlays starting in next-20171009

2017-10-18 Thread David Gibson
t; > show > > below are (I'd actually have to spend a few minutes thinking about ranges, > > and > > I don't have the cycles right now). > > Well, yes all the simple localized checks should work, but as we add > more complex checks with either dtc or the schema we'll have after > ELCE next week there's a lot we can't validate. Perhaps we have to > place some restrictions on overlays so we can validate them better. Reworking overlay handling in dtc will help at least insofar as making it easier to work out which checks can be applied to overlay fragments and which only make sense on a fully assembled tree. There will still be plenty of things that can't be checked on overlays, since they absolitely require information from the base tree. This is a reason I really prefer the (alas, stalled) connector proposal, since it makes it much more explicit what the external dependencies of the fragments are. > I do wonder if we could add tags to phandles to make them > identifiable. Perhaps making them all 0xFF?? instead of starting > at 1. 2^24 phandles should be enough for anyone(TM). True, in a sense. However this is a problem for systems generating FDTs from a real OF. On real OF, the phandles are usually pointers inside OF, and if it happens to allocate it's memory at the top of the address space, phandles in the 0xff?? range are entirely plausible. 0 and -1 are the only values explicitly disallowed by IEEE1275, so they're the only safe values to use as markers. > That would not > completely solve this problem, but then we could at least find the > phandles in a property. No, it wouldn't do that reliably, because a 0xff?? value could just as well appear as another integer value in a property. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson signature.asc Description: PGP signature

Re: dtc issue with overlays starting in next-20171009

2017-10-18 Thread David Gibson
lem unless you have the base DT. > > > > Yes, maybe. But there are still some useful warnings for overlays, maybe. > > I'm > > not sure what the implications of the "range_format" warning that I will > > show > > below are (I'd actuall

Re: dtc issue with overlays starting in next-20171009

2017-10-18 Thread David Gibson
pga-region"; > fpga-bridges = <_controller_0>; > ranges; > }; > > freeze_controller_0: freeze_controller@10450 { > compati

Re: dtc issue with overlays starting in next-20171009

2017-10-18 Thread David Gibson
gion"; > fpga-bridges = <_controller_0>; > ranges; > }; > > freeze_controller_0: freeze_controller@10450 { > compatible = "altr,freeze-bridge-c

Re: [RFC] yamldt v0.5, now a DTS compiler too

2017-10-10 Thread David Gibson
On Tue, Oct 10, 2017 at 06:19:03PM +0300, Pantelis Antoniou wrote: > Hi David, > > > On Oct 10, 2017, at 04:50 , David Gibson <da...@gibson.dropbear.id.au> > > wrote: > > > > On Mon, Oct 09, 2017 at 06:07:28PM +0300, Pantelis Antoniou wrote: > >> H

Re: [RFC] yamldt v0.5, now a DTS compiler too

2017-10-10 Thread David Gibson
On Tue, Oct 10, 2017 at 06:19:03PM +0300, Pantelis Antoniou wrote: > Hi David, > > > On Oct 10, 2017, at 04:50 , David Gibson > > wrote: > > > > On Mon, Oct 09, 2017 at 06:07:28PM +0300, Pantelis Antoniou wrote: > >> Hi David, > >> > >&g

Re: [RFC] yamldt v0.5, now a DTS compiler too

2017-10-09 Thread David Gibson
On Mon, Oct 09, 2017 at 06:07:28PM +0300, Pantelis Antoniou wrote: > Hi David, > > > On Oct 9, 2017, at 03:00 , David Gibson <da...@gibson.dropbear.id.au> wrote: > > > > On Sun, Oct 08, 2017 at 04:08:03PM -0700, Frank Rowand wrote: > >> On 10/07/17 03:23

Re: [RFC] yamldt v0.5, now a DTS compiler too

2017-10-09 Thread David Gibson
On Mon, Oct 09, 2017 at 06:07:28PM +0300, Pantelis Antoniou wrote: > Hi David, > > > On Oct 9, 2017, at 03:00 , David Gibson wrote: > > > > On Sun, Oct 08, 2017 at 04:08:03PM -0700, Frank Rowand wrote: > >> On 10/07/17 03:23, Pantelis Antoniou wrote: > >

Re: [RFC] yamldt v0.5, now a DTS compiler too

2017-10-08 Thread David Gibson
gt; and the interface between the live tree and the overlay is a > connector. In addition, no amount of schema validation can really protect the kernel from a bad DT. Even if the schemas can 100% verify that the DT is "syntactically" correct, which is ambitious, it can't protect again

Re: [RFC] yamldt v0.5, now a DTS compiler too

2017-10-08 Thread David Gibson
nnector. In addition, no amount of schema validation can really protect the kernel from a bad DT. Even if the schemas can 100% verify that the DT is "syntactically" correct, which is ambitious, it can't protect against a DT which is in the right form, but contains information tha

Re: [RFC PATCH v5 1/5] iommu: Add capabilities to a group

2017-08-09 Thread David Gibson
t; filtering; this is useful when deciding whether or not to allow mapping > of MSIX table to the userspace. Various architectures will enable it > when they decide that it is safe to do so. > > Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> Reviewed-by: David Gibson <da...@gibson

Re: [RFC PATCH v5 1/5] iommu: Add capabilities to a group

2017-08-09 Thread David Gibson
t; filtering; this is useful when deciding whether or not to allow mapping > of MSIX table to the userspace. Various architectures will enable it > when they decide that it is safe to do so. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson This seems like a reasonable concep

Re: [RFC PATCH v5 5/5] vfio-pci: Allow to expose MSI-X table to userspace when safe

2017-08-09 Thread David Gibson
t; an IOMMU group. > > Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> Reviewed-by: David Gibson <da...@gibson.dropbear.id.au> > --- > include/linux/vfio.h | 1 + > drivers/vfio/pci/vfio_pci.c | 20 +--- > drivers/vfio/pci/vfio_pci_rdwr

Re: [RFC PATCH v5 5/5] vfio-pci: Allow to expose MSI-X table to userspace when safe

2017-08-09 Thread David Gibson
t; an IOMMU group. > > Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson > --- > include/linux/vfio.h | 1 + > drivers/vfio/pci/vfio_pci.c | 20 +--- > drivers/vfio/pci/vfio_pci_rdwr.c | 5 - > drivers/vfio/vfio.c | 15

Re: [PATCH v2] include/linux/vfio.h: Guard powerpc-specific functions with CONFIG_VFIO_SPAPR_EEH

2017-07-25 Thread David Gibson
se of IS_ENABLED() macro because CONFIG_VFIO_SPAPR_EEH is a tristate > option. > > This issue was found during a randconfig build. Logs are here: > > http://kisskb.ellerman.id.au/kisskb/buildresult/12982362/ > > Signed-off-by: Murilo Opsfelder Araujo <mopsfel...@gmail.com

Re: [PATCH v2] include/linux/vfio.h: Guard powerpc-specific functions with CONFIG_VFIO_SPAPR_EEH

2017-07-25 Thread David Gibson
se of IS_ENABLED() macro because CONFIG_VFIO_SPAPR_EEH is a tristate > option. > > This issue was found during a randconfig build. Logs are here: > > http://kisskb.ellerman.id.au/kisskb/buildresult/12982362/ > > Signed-off-by: Murilo Opsfelder Araujo Reviewed-by: Dav

Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove

2017-07-23 Thread David Gibson
; > dlpar_detach_node() and pSeries_reconfig_remove_node() call > of_detach_node(), and thus the node should not be released > in this case too. > > Signed-off-by: Laurent Vivier <lviv...@redhat.com> Reviewed-by: David Gibson <da...@gibson.dropbear.id.au> > --- > arch/powerpc/platforms

Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove

2017-07-23 Thread David Gibson
; > dlpar_detach_node() and pSeries_reconfig_remove_node() call > of_detach_node(), and thus the node should not be released > in this case too. > > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > arch/powerpc/platforms/pseries/reconfig.c | 1 - > 1 file changed, 1 deletion(-) &g

[PATCH] virtio_scsi: Always try to read VPD pages

2017-04-12 Thread David Gibson
for the storvsc (Hyper-V) SCSI controller, although that exists for slightly different reasons. A specific case which causes this is a volume from IBM's IPR RAID controller (which presents as an SPC-2 device, although it does support VPD) passed through with qemu's 'scsi-block' device. Signed-off-by: David

[PATCH] virtio_scsi: Always try to read VPD pages

2017-04-12 Thread David Gibson
for the storvsc (Hyper-V) SCSI controller, although that exists for slightly different reasons. A specific case which causes this is a volume from IBM's IPR RAID controller (which presents as an SPC-2 device, although it does support VPD) passed through with qemu's 'scsi-block' device. Signed-off-by: David

[PATCH] powerpc/pseries: Don't give a warning when HPT resizing isn't available

2017-03-16 Thread David Gibson
we'll give a harmless, but scary warning. This patch suppresses the warning in this case. It will still warn if the feature is supposed to be available, but didn't work. Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> --- arch/powerpc/mm/hash_utils_64.c | 2 +- 1 file changed, 1

[PATCH] powerpc/pseries: Don't give a warning when HPT resizing isn't available

2017-03-16 Thread David Gibson
we'll give a harmless, but scary warning. This patch suppresses the warning in this case. It will still warn if the feature is supposed to be available, but didn't work. Signed-off-by: David Gibson --- arch/powerpc/mm/hash_utils_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Kind o

Re: [PATCH] KVM: Prevent double-free on HPT resize commit path

2017-02-27 Thread David Gibson
On Wed, Feb 15, 2017 at 02:40:04PM +1100, David Gibson wrote: > resize_hpt_release(), called once the HPT resize of a KVM guest is > completed (successfully or unsuccessfully) free()s the state structure for > the resize. It is currently not safe to call with a NULL pointer. > &g

Re: [PATCH] KVM: Prevent double-free on HPT resize commit path

2017-02-27 Thread David Gibson
On Wed, Feb 15, 2017 at 02:40:04PM +1100, David Gibson wrote: > resize_hpt_release(), called once the HPT resize of a KVM guest is > completed (successfully or unsuccessfully) free()s the state structure for > the resize. It is currently not safe to call with a NULL pointer. > &g

[PATCH] KVM: Prevent double-free on HPT resize commit path

2017-02-14 Thread David Gibson
resize_hpt_release() with a NULL resize pointer. Found by Dan Carpenter with a static checker. Reported-by: Dan Carpenter <dan.carpen...@oracle.com> Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 3 +++ 1 file changed, 3 inserti

[PATCH] KVM: Prevent double-free on HPT resize commit path

2017-02-14 Thread David Gibson
resize_hpt_release() with a NULL resize pointer. Found by Dan Carpenter with a static checker. Reported-by: Dan Carpenter Signed-off-by: David Gibson --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch

Re: [PATCHv2 00/11] KVM implementation of PAPR HPT resizing extension

2017-01-31 Thread David Gibson
On Wed, Feb 01, 2017 at 09:18:13AM +1100, Paul Mackerras wrote: > On Tue, Dec 20, 2016 at 04:48:56PM +1100, David Gibson wrote: > > Here is the KVM implementation for the proposed PAPR extension which > > allows the runtime resizing of a PAPR guest's Hashed Page Table (HPT).

Re: [PATCHv2 00/11] KVM implementation of PAPR HPT resizing extension

2017-01-31 Thread David Gibson
On Wed, Feb 01, 2017 at 09:18:13AM +1100, Paul Mackerras wrote: > On Tue, Dec 20, 2016 at 04:48:56PM +1100, David Gibson wrote: > > Here is the KVM implementation for the proposed PAPR extension which > > allows the runtime resizing of a PAPR guest's Hashed Page Table (HPT).

Re: [PATCH] vfio/spapr: fail tce_iommu_attach_group() when iommu_data is null

2017-01-30 Thread David Gibson
_data, > > /* pr_debug("tce_vfio: Attaching group #%u to iommu %p\n", > > iommu_group_id(iommu_group), iommu_group); */ > > table_group = iommu_group_get_iommudata(iommu_group); > > + if (!table_group) { > > + ret = -ENODEV; > > + goto unlock_exit; > > + } > > > > if (tce_groups_attached(container) && (!table_group->ops || > > !table_group->ops->take_ownership || > > > > Seems sane to me. > > David/Alexey, please review. Thanks, Seems reasonable. -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson signature.asc Description: PGP signature

Re: [PATCH] vfio/spapr: fail tce_iommu_attach_group() when iommu_data is null

2017-01-30 Thread David Gibson
16 100644 > > --- a/drivers/vfio/vfio_iommu_spapr_tce.c > > +++ b/drivers/vfio/vfio_iommu_spapr_tce.c > > @@ -1270,6 +1270,10 @@ static int tce_iommu_attach_group(void *iommu_data, > > /* pr_debug("tce_vfio: Attaching group #%u to iommu %p\n", > >

[PATCHv2 05/11] powerpc/kvm: Don't store values derivable from HPT order

2016-12-19 Thread David Gibson
-by: David Gibson <da...@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <th...@redhat.com> --- arch/powerpc/include/asm/kvm_book3s_64.h | 12 arch/powerpc/include/asm/kvm_host.h | 2 -- arch/powerpc/kvm/book3s_64_mmu_hv.c | 28 +--- arch

[PATCHv2 03/11] powerpc/kvm: Rename kvm_alloc_hpt() for clarity

2016-12-19 Thread David Gibson
() to kvm_alloc_hpt_cma(). Similarly, kvm_release_hpt() is renamed kvm_free_hpt_cma(). Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <th...@redhat.com> --- arch/powerpc/include/asm/kvm_ppc.h | 4 ++-- arch/powerpc/kvm/book3s_64_mmu_hv.c | 8

[PATCHv2 11/11] powerpc/kvm: Advertise availablity of HPT resizing on KVM HV

2016-12-19 Thread David Gibson
This updates the KVM_CAP_SPAPR_RESIZE_HPT capability to advertise the presence of in-kernel HPT resizing on KVM HV. Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> --- arch/powerpc/kvm/powerpc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kvm/powerpc.c

  1   2   3   4   5   6   7   8   9   10   >