Re: [PATCH] hw/net: prevent potential NULL dereference

2024-05-30 Thread David Gibson
On Thu, May 30, 2024 at 10:03:51AM +0100, Peter Maydell wrote: > On Thu, 30 May 2024 at 01:52, David Gibson > wrote: > > > > On Wed, May 29, 2024 at 02:07:18PM +0300, Oleg Sviridov wrote: > > > Pointer, returned from function 'spapr_vio_find_by_reg', may be NULL

Re: [PATCH] hw/net: prevent potential NULL dereference

2024-05-29 Thread David Gibson
; > > +if (!dev) { > +return H_PARAMETER; > +} > + > for (i = 0; i < ETH_ALEN; i++) { > dev->nicconf.macaddr.a[ETH_ALEN - i - 1] = macaddr & 0xff; > macaddr >>= 8; -- David Gibson| I'll have my music ba

Re: [PATCH v2 09/10] ppc: Make Power11 as default cpu type for 'pseries' and 'powernv'

2024-04-28 Thread David Gibson
> > > > Cc: Cédric Le Goater > > Cc: Daniel Henrique Barboza > > Cc: David Gibson > > Cc: Frédéric Barrat > > Cc: Harsh Prateek Bora > > Cc: Mahesh J Salgaonkar > > Cc: Madhavan Srinivasan > > Cc: Nicholas Piggin > > Signed-off-by:

Re: [PATCH v2 04/10] ppc/spapr: Remove copy-paste from pa-features

2024-03-13 Thread David Gibson
/* 42: PM, 44: PC RA, 46: SC vec'd */ > 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, /* 42 - 47 */ > /* 48: SIMD, 50: QP BFP, 52: String */ -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT

Re: [PATCH v2 03/10] ppc/spapr|pnv: Remove SAO from pa-features

2024-03-13 Thread David Gibson
SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ > -/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, SSO, 5: LE|CFAR|EB|LSQ > */ > -0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0, /* 0 - 5 */ > +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ > +0

Re: [PATCH v8 2/2] ppc: spapr: Enable 2nd DAWR on Power10 pSeries machine

2024-02-27 Thread David Gibson
et_ciabr(PowerPCCPU *cpu, > > return H_SUCCESS; > > } > > > > -static target_ulong h_set_mode_resource_set_dawr0(PowerPCCPU *cpu, > > - SpaprMachineState *spapr, > > -

Re: [PATCH] spapr: avoid overhead of finding vhyp class in critical operations

2024-02-25 Thread David Gibson
base = ppc_hash64_hpt_base(cpu); > @@ -837,9 +831,7 @@ static void ppc_hash64_set_c(PowerPCCPU *cpu, hwaddr > ptex, uint64_t pte1) > hwaddr base, offset = ptex * HASH_PTE_SIZE_64 + HPTE64_DW1_C; > > if (cpu->vhyp) { > -PPCVirtualHypervisorClass *vhc = > -

Re: [PATCH] MAINTAINERS: Remove myself as reviewer from PPC

2024-02-20 Thread David Gibson
Odd Fixes > F: target/ppc/kvm.c > > @@ -1502,7 +1500,6 @@ F: tests/avocado/ppc_prep_40p.py > sPAPR (pseries) > M: Nicholas Piggin > R: Daniel Henrique Barboza > -R: Cédric Le Goater > R: David Gibson > R: Harsh Prateek Bora > L: qemu-...@nongnu.org

Re: spapr watchdog vs watchdog_perform_action() / QMP watchdog-set-action

2024-01-28 Thread David Gibson
t;action is reset because the user never expressed a preference" > and "action is reset because the user specifically asked for that", > but I guess in theory we could make that distinction. (Conveniently > there is no QMP action for "query current watchdog-action state&

Re: [PATCH 2/8] ppc/spapr|pnv: Remove SAO from pa-features when running MTTCG

2024-01-24 Thread David Gibson
On Tue, Jan 23, 2024 at 11:57:56AM +1000, Nicholas Piggin wrote: > On Fri Jan 19, 2024 at 10:23 AM AEST, David Gibson wrote: > > On Fri, Jan 19, 2024 at 12:09:36AM +1000, Nicholas Piggin wrote: > > > SAO is a page table attribute that strengthens the memory ordering of &g

Re: [PATCH 2/8] ppc/spapr|pnv: Remove SAO from pa-features when running MTTCG

2024-01-18 Thread David Gibson
* academic. > + */ > +pa_features[4 + 2] &= ~0x80; Oof.. I see the reasoning but modifying guest visible parameters based on host capabilities without a cap really worries me nonetheless. > + } > + > if (ppc_hash64_has(cpu, PPC_HASH64_CI_LARGEPAGE

Re: [PATCH] ppc: qtest already exports qtest_rtas_call()

2023-10-30 Thread David Gibson
inja: build stopped: subcommand failed. > > make: *** [Makefile:162: run-ninja] Error 1 > > > > Signed-off-by: Juan Quintela > > > Reviewed-by: Cédric Le Goater I think changing the name of one of the functions would be even better. Making it static means it won'

Re: [PATCH 4/4] hw/ppc/spapr: Rename 'softmmu' -> 'tcg'

2023-10-02 Thread David Gibson
es( > - 'spapr_softmmu.c', > + 'spapr_tcg.c', > )) > ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c')) > ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files( -- David Gibson| I'll have my music baroque,

Re: [PATCH 3/4] hw/ppc/spapr_hcall: Rename {softmmu -> tcgppc}_resize_hpt_prepare/commit

2023-10-02 Thread David Gibson
{ > -return softmmu_resize_hpt_commit(cpu, spapr, flags, shift); > +return tcgppc_resize_hpt_commit(cpu, spapr, flags, shift); > } else { > g_assert_not_reached(); > } -- 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] MAINTAINERS: Nick Piggin PPC maintainer, other PPC changes

2023-09-15 Thread David Gibson
uired knowledge and motivation to drive the boat. > > - Greg Kurz is being removed from all qemu-ppc entries. Greg has moved > to other areas of interest and will retire from qemu-ppc. Thanks Mr > Kurz for all the years of service. > > - David Gibson was removed as 'Review

Re: [PATCH] hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()

2023-06-20 Thread David Gibson
e don't care about > KVM, we really want to test for TCG. > > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Gibson > --- > hw/ppc/spapr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index dcb7f

Re: [PATCH 3/3] net: socket: remove net_init_socket()

2023-06-14 Thread David Gibson
vier Reviewed-by: David Gibson > --- > net/socket.c | 43 +-- > 1 file changed, 17 insertions(+), 26 deletions(-) > > diff --git a/net/socket.c b/net/socket.c > index 6b1f0fec3a10..8e3702e1f3a8 100644 > --- a/net/socket.c > +++ b/net

Re: [PATCH 2/3] net: socket: move fd type checking to its own function

2023-06-14 Thread David Gibson
On Fri, 9 Jun 2023 09:27:47 +0200 Laurent Vivier wrote: > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > net/socket.c | 28 > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/net/socket.c b/net/socket.c &g

Re: [PATCH 1/3] net: socket: prepare to cleanup net_init_socket()

2023-06-14 Thread David Gibson
s. Reviewed-by: David Gibson > --- > net/socket.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/net/socket.c b/net/socket.c > index ba6e5b0b0035..24dcaa55bc46 100644 > --- a/net/socket.c > +++ b/net/socket.c > @@ -587,7 +587,7 @@ static int

Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE)

2022-12-21 Thread David Gibson
On Wed, Dec 21, 2022 at 10:15:28PM +, Peter Maydell wrote: > On Wed, 21 Dec 2022 at 16:03, Cédric Le Goater wrote: > > > > On 12/21/22 13:33, Peter Maydell wrote: > > > On Wed, 21 Dec 2022 at 01:35, David Gibson > > > wrote: > > >> On Mon, De

Re: [PATCH-for-8.0 4/4] hw/ppc/spapr_ovec: Avoid target_ulong spapr_ovec_parse_vector()

2022-12-21 Thread David Gibson
code is not consistent in another places : > > > >   hw/ppc/spapr_tpm_proxy.c uses a uint64_t > >   hw/ppc/spapr_hcall.c, a target_ulong > >   hw/ppc/spapr_rtas.c, a hwaddr > >   hw/ppc/spapr_drc.c, a hwaddr indirectly > > > > Should we change ppc64_phys_to_r

Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE)

2022-12-20 Thread David Gibson
On Mon, Dec 19, 2022 at 10:39:40AM +, Peter Maydell wrote: > On Mon, 19 Dec 2022 at 06:35, David Gibson > wrote: > > > > On Fri, Dec 16, 2022 at 09:39:19PM +, Peter Maydell wrote: > > > On Fri, 16 Dec 2022 at 19:11, Daniel He

Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE)

2022-12-18 Thread David Gibson
ors. When these macros were created, an ISA nearly always used the same endianness, but that's not really true any more - not just for POWER, but for a bunch of targets. So from that point of view, I think getting rid of tswap() - particularly one that has compile time semantics, rather tha

Re: [PATCH for-8.0] MAINTAINERS: downgrade PPC KVM/TCG CPUs and pSeries to 'Odd Fixes'

2022-11-17 Thread David Gibson
time since the middle > > of the 7.2 development cycle. > > > > Great thanks Daniel for all your contributions over > the years, and for being the one steering the vessel > to the dry dock. This is it. Seconded. Reviewed-by: David Gibson > > > Change the status of PPC KVM

Re: [PATCH v10 05/17] net: introduce qemu_set_info_str() function

2022-10-06 Thread David Gibson
On Wed, Oct 05, 2022 at 06:20:39PM +0200, Laurent Vivier wrote: > Embed the setting of info_str in a function. > > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > include/net/net.h | 1 + > net/l2tpv3.c | 3 +-- > net/net.c | 17 +++

Re: [PATCH v10 08/17] net: stream: Don't ignore EINVAL on netdev socket connection

2022-10-06 Thread David Gibson
no Brivio > [lvivier: applied to net/stream.c] > Signed-off-by: Laurent Vivier > Reviewed-by: Daniel P. Berrangé Reviewed-by: David Gibson > --- > net/stream.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/net/stream.c b/net/stream.c > ind

Re: [PATCH v10 07/17] net: socket: Don't ignore EINVAL on netdev socket connection

2022-10-06 Thread David Gibson
Brivio > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > net/socket.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/net/socket.c b/net/socket.c > index ade1ecf38b87..4944bb70d580 100644 > --- a/net/socket.c > +++

Re: [PATCH v9 05/16] qapi: net: add stream and dgram netdevs

2022-10-05 Thread David Gibson
On Wed, Oct 05, 2022 at 12:08:27PM +0200, Laurent Vivier wrote: > On 9/28/22 07:55, David Gibson wrote: > > > +static int net_stream_server_init(NetClientState *peer, > > > + const char *model, > > > +

Re: [PATCH v9 08/16] net: stream: add unix socket

2022-10-05 Thread David Gibson
On Wed, Oct 05, 2022 at 03:38:09PM +0200, Laurent Vivier wrote: > On 9/28/22 08:12, David Gibson wrote: > > > @@ -253,9 +253,27 @@ static void net_stream_accept(void *opaque) > > > s->fd = fd; > > > s->nc.link_down = false; > > >

Re: [PATCH] MAINTAINERS: step back from PPC

2022-09-30 Thread David Gibson
e I am not > > funded for this work. > > > > Signed-off-by: Cédric Le Goater > > --- > > End of an era. Thank you for all the dedication and accomplishments ! Seconded. Reviewed-by: David Gibson > > Reviewed-by: Greg Kurz > > > MAINTAINERS | 10 +-

Re: [PATCH v9 05/16] qapi: net: add stream and dgram netdevs

2022-09-28 Thread David Gibson
t;nc.info_str, sizeof(s->nc.info_str), info_str); > +g_free(info_str); > + > +return 0; > +} > + > +int net_init_stream(const Netdev *netdev, const char *name, > +NetClientState *peer, Error **errp) > +{ > +const NetdevStreamOpti

Re: [PATCH v9 01/16] net: introduce convert_host_port()

2022-09-28 Thread David Gibson
On Mon, Sep 26, 2022 at 09:50:33PM +0200, Laurent Vivier wrote: > Signed-off-by: Laurent Vivier > Reviewed-by: Stefano Brivio Reviewed-by: David Gibson > --- > include/qemu/sockets.h | 2 ++ > net/net.c | 62 ++ > 2

Re: [PATCH v9 03/16] net: simplify net_client_parse() error management

2022-09-28 Thread David Gibson
> Reviewed-by: Markus Armbruster Reviewed-by: David Gibson > --- > include/net/net.h | 2 +- > net/net.c | 6 ++ > softmmu/vl.c | 12 +++- > 3 files changed, 6 insertions(+), 14 deletions(-) > > diff --git a/include/net/net.h b/include/net/ne

Re: [PATCH v9 13/16] qemu-sockets: update socket_uri() and socket_parse() to be consistent

2022-09-28 Thread David Gibson
n Gilbert > Reviewed-by: Markus Armbruster Reviewed-by: David Gibson > --- > util/qemu-sockets.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c > index 9f6f655fd526..a9926af714c4 100644 > --- a/u

Re: [PATCH v9 11/16] net: dgram: add unix socket

2022-09-28 Thread David Gibson
On Mon, Sep 26, 2022 at 09:50:43PM +0200, Laurent Vivier wrote: > Signed-off-by: Laurent Vivier > Reviewed-by: Stefano Brivio Reviewed-by: David Gibson Although one note below. > --- > net/dgram.c | 65 ++--- > qapi/net.json

Re: [PATCH v9 08/16] net: stream: add unix socket

2022-09-28 Thread David Gibson
ver socket (default: true) > # > -# Only SocketAddress types 'inet' and 'fd' are supported. > +# Only SocketAddress types 'unix', 'inet' and 'fd' are supported. > # > # Since: 7.1 > ## > diff --git a/qemu-options.hx b/qemu-options.hx > index 8c765f345da8..7a34022ac651 100644 > ---

Re: [PATCH v9 09/16] net: dgram: make dgram_dst generic

2022-09-28 Thread David Gibson
uct sockaddr_in laddr_in; > +struct sockaddr_in laddr_in, raddr_in; > > if (convert_host_port(_in, local->u.inet.host, > local->u.inet.port, >errp) < 0) { > @@ -492,9 +503,12 @@ static int net_dgram_init(NetClientState *peer, > }

Re: [PATCH v8 06/14] net: stream: Don't ignore EINVAL on netdev socket connection

2022-09-13 Thread David Gibson
} else { > error_setg_errno(errp, errno, "can't connect socket"); -- 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 v8 11/14] qemu-sockets: move and rename SocketAddress_to_str()

2022-09-13 Thread David Gibson
s from a string. > > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > include/qemu/sockets.h | 2 +- > monitor/hmp-cmds.c | 23 +-- > util/qemu-sockets.c| 20 > 3 files changed, 22 insertions(+), 23 deletio

Re: [PATCH v8 07/14] net: stream: add unix socket

2022-09-13 Thread David Gibson
ed. > # > # Since: 7.1 > ## > diff --git a/qemu-options.hx b/qemu-options.hx > index bb16a61bae8e..8870bcce6bcd 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -2733,6 +2733,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, > "configure a network backend to connect to another > network\n" > "using an UDP tunnel\n" > "-netdev > stream,id=str[,server=on|off],addr.type=inet,addr.host=host,addr.port=port\n" > +"-netdev stream,id=str[,server=on|off],addr.type=unix,addr.path=path\n" > "-netdev stream,id=str[,server=on|off],addr.type=fd,addr.str=h\n" > "configure a network backend to connect to another > network\n" > "using a socket connection in stream mode.\n" -- 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 v8 05/14] qapi: net: add stream and dgram netdevs

2022-09-13 Thread David Gibson
name, fd); > +return -1; > +} > +connected = 1; > +info_str = g_strdup_printf("connect to fd %d", fd); > +break; > +default: > +error_setg(errp, "only support inet or fd type"); > +return -1; > +} >

Re: [PATCH v8 02/14] net: remove the @errp argument of net_client_inits()

2022-09-13 Thread David Gibson
by: Markus Armbruster Reviewed-by: David Gibson > --- > include/net/net.h | 2 +- > net/net.c | 20 +++- > softmmu/vl.c | 2 +- > 3 files changed, 9 insertions(+), 15 deletions(-) > > diff --git a/include/net/net.h b/include/net/net.h

Re: [PATCH v8 03/14] net: simplify net_client_parse() error management

2022-09-13 Thread David Gibson
> Reviewed-by: Markus Armbruster Reviewed-by: David Gibson > --- > include/net/net.h | 2 +- > net/net.c | 6 ++ > softmmu/vl.c | 12 +++- > 3 files changed, 6 insertions(+), 14 deletions(-) > > diff --git a/include/net/net.h b/include/net/ne

Re: [PATCH v8 01/14] net: introduce convert_host_port()

2022-09-13 Thread David Gibson
On Tue, Sep 13, 2022 at 08:39:47AM +0200, Laurent Vivier wrote: > Signed-off-by: Laurent Vivier > Reviewed-by: Stefano Brivio Reviewed-by: David Gibson Although, if you do respin, an actual commit message would be nice to have. > --- > include/qemu/sockets.h | 2 ++

Re: [PATCH for-7.2 v4 15/21] qmp/hmp, device_tree.c: introduce 'info fdt' command

2022-08-31 Thread David Gibson
On Tue, Aug 30, 2022 at 12:43:23PM +0200, Markus Armbruster wrote: > David Gibson writes: > > > On Mon, Aug 29, 2022 at 07:00:55PM -0300, Daniel Henrique Barboza wrote: > >> > >> > >> On 8/29/22 00:34, David Gibson wrote: > >> > On Fri, Aug 26

Re: [PATCH for-7.2 v2 10/20] hw/ppc: set machine->fdt in spapr machine

2022-08-31 Thread David Gibson
On Mon, Aug 22, 2022 at 07:30:36AM -0300, Daniel Henrique Barboza wrote: > > > On 8/22/22 00:29, Alexey Kardashevskiy wrote: > > > > > > On 22/08/2022 13:05, David Gibson wrote: > > > On Fri, Aug 19, 2022 at 06:42:34AM -0300, Daniel Henrique Barboza wrote:

Re: [PATCH for-7.2 v4 15/21] qmp/hmp, device_tree.c: introduce 'info fdt' command

2022-08-29 Thread David Gibson
On Mon, Aug 29, 2022 at 07:00:55PM -0300, Daniel Henrique Barboza wrote: > > > On 8/29/22 00:34, David Gibson wrote: > > On Fri, Aug 26, 2022 at 11:11:44AM -0300, Daniel Henrique Barboza wrote: > > > Reading the FDT requires that the user saves the fdt_blob and then

Re: [PATCH for-7.2 v4 15/21] qmp/hmp, device_tree.c: introduce 'info fdt' command

2022-08-28 Thread David Gibson
4; > + > +fdt_for_each_property_offset(property, fdt, node) { > +prop = fdt_get_property_by_offset(fdt, property, _size); > +propname = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); > + > +g_string_append_printf(buf, "%*s%s;\n", padding, "&q

Re: [PATCH for-7.2 v4 10/21] hw/ppc: set machine->fdt in spapr machine

2022-08-28 Thread David Gibson
ifically the boot time DT before guest firmware or OS does any further mangling of it. That's effectively what it means for all the other embedded cases, though in those cases the firmware usually doesn't need to do further modifications, unlike a "full OF" environment like spapr. Reviewed-

Re: [PATCH for-7.2 v2 10/20] hw/ppc: set machine->fdt in spapr machine

2022-08-21 Thread David Gibson
esting though, was merely to make ms::fdt accessible as a single bytestring property on the machine QOM object. Effectively it's just "dumpdtb" but as a property get. I'm not 100% certain if QOM can safely represent arbitrary bytestrings as QOM properties,

Re: [PATCH for-7.2 v2 10/20] hw/ppc: set machine->fdt in spapr machine

2022-08-18 Thread David Gibson
have additional funtionality in formatting the contents more helpfully. > Another thing is that on every HMP dump I'd probably rebuild the entire FDT > for the reasons David explained. Thanks, This would require per-machine hooks, however. -- David Gibson| I'll h

Re: [PATCH for-7.2 v2 15/20] qmp/hmp, device_tree.c: introduce 'info fdt' command

2022-08-18 Thread David Gibson
On Mon, Aug 15, 2022 at 07:48:14PM -0300, Daniel Henrique Barboza wrote: > > > On 8/8/22 01:21, David Gibson wrote: > > On Fri, Aug 05, 2022 at 06:39:43AM -0300, Daniel Henrique Barboza wrote: > > > Reading the FDT requires that the user saves the fdt_blob and then

Re: [PATCH 2/2] hw/mips/boston: Pack fdt in fdt filter

2022-08-18 Thread David Gibson
1, ram_high_sz); > >> +fdt_pack(fdt); > >> fdt = g_realloc(fdt, fdt_totalsize(fdt)); > >> qemu_fdt_dumpdtb(fdt, fdt_sz); > >> > > > > Why not pack by default in qemu_fdt_dumpdtb()? > > qemu_fdt_dumpdtb() i

Re: [PATCH for-7.2 v3 20/20] hmp, device_tree.c: add 'info fdt ' support

2022-08-18 Thread David Gibson
path_offset(fdt, nodepath); > if (node < 0) { > error_setg(errp, "node '%s' not found in FDT", nodepath); > return NULL; > } > > -fdt_format_node(buf, node, 0, nodepath); > +if (!has_propname) { > +fdt_format_node(buf, node, 0, no

Re: [RFC PATCH 01/13] target/ppc: define PPC_INTERRUPT_* values directly

2022-08-18 Thread David Gibson
em > directly like that to save some clutter. No functional change intended. > > Signed-off-by: Matheus Ferst Good idea. Reviewed-by: David Gibson > --- > hw/ppc/ppc.c | 10 +++--- > hw/ppc/trace-events | 2 +- > target/ppc/cpu.h | 40 +++-

Re: [PATCH for-7.2 v3 16/20] device_tree.c: support string array prop in fdt_format_node()

2022-08-18 Thread David Gibson
= NULL; > @@ -681,7 +738,12 @@ static void fdt_format_node(GString *buf, int node, int > depth) > prop = fdt_get_property_by_offset(fdt, property, _size); > propname = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); > > -g_string_append_printf(buf, "%*s%s;\n", padding, "", propname); > +if (fdt_prop_is_string_array(prop->data, prop_size)) { > +fdt_prop_format_string_array(buf, propname, prop->data, > + prop_size, padding); > +} else { > +g_string_append_printf(buf, "%*s%s;\n", padding, "", propname); > +} > } > > padding -= 4; -- 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 for-7.2 v3 18/20] device_node.c: enable 'info fdt' to print subnodes

2022-08-18 Thread David Gibson
g_string_append_printf(buf, "%*s}\n", padding, ""); > } > @@ -821,7 +834,7 @@ HumanReadableText *qemu_fdt_qmp_query_fdt(const char > *nodepath, Error **errp) > return NULL; > } > > -fdt_format_node(buf, node, 0); > +fdt_fo

Re: [PATCH for-7.2 v3 10/20] hw/ppc: set machine->fdt in spapr machine

2022-08-18 Thread David Gibson
> +/* > + * Set the machine->fdt pointer again since we just freed > + * it above (by freeing spapr->fdt_blob). We set this > + * pointer to enable support for 'dumpdtb' and 'info fdt' > + * QMP/HMP commands. > + */ > +MACHINE(spapr)->fdt = fdt; > + >

Re: [PATCH for-7.2 v2 10/20] hw/ppc: set machine->fdt in spapr machine

2022-08-14 Thread David Gibson
On Fri, Aug 12, 2022 at 07:23:09PM -0300, Daniel Henrique Barboza wrote: > > > On 8/8/22 00:26, David Gibson wrote: > > On Fri, Aug 05, 2022 at 06:39:38AM -0300, Daniel Henrique Barboza wrote: > > > The pSeries machine never bothered with the common machine->fdt

Re: [PATCH for-7.2 v2 01/20] hw/arm: do not free machine->fdt in arm_load_dtb()

2022-08-14 Thread David Gibson
On Fri, Aug 12, 2022 at 07:03:26PM -0300, Daniel Henrique Barboza wrote: > David, > > On 8/8/22 00:23, David Gibson wrote: > > On Fri, Aug 05, 2022 at 06:39:29AM -0300, Daniel Henrique Barboza wrote: > > > At this moment, arm_load_dtb() can free machine->fdt when > &

Re: [PATCH for-7.2 v2 16/20] device_tree.c: support string props in fdt_format_node()

2022-08-10 Thread David Gibson
On Wed, Aug 10, 2022 at 04:40:18PM -0300, Daniel Henrique Barboza wrote: > > > On 8/8/22 01:36, David Gibson wrote: > > On Fri, Aug 05, 2022 at 06:39:44AM -0300, Daniel Henrique Barboza wrote: > > > To support printing string properties in 'info fdt' we need to determ

Re: [PATCH for-7.2 v2 15/20] qmp/hmp, device_tree.c: introduce 'info fdt' command

2022-08-07 Thread David Gibson
quot;); So, this lists it in dts format... kind of. Because you don't include the property values, it makes it look like all properties are binary (either absent or present-but-empty). I think that's misleading. If you're only going to list properties, I think you'd be better off using different formatti

Re: [PATCH for-7.2 v2 16/20] device_tree.c: support string props in fdt_format_node()

2022-08-07 Thread David Gibson
t;", propname, prop->data); If you're going for dts like output, I'd suggest going all the way. That means \" instead of \' and a ';' at the end of the line. > +} else { > +g_string_append_printf(buf, "%*s%s;\n", padding, "", propname); > +} > } > > padding -= 4; -- 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 for-7.2 v2 17/20] device_tree.c: support remaining FDT prop types

2022-08-07 Thread David Gibson
t; + > if (fdt_prop_is_string(prop->data, prop_size)) { > g_string_append_printf(buf, "%*s%s = '%s'\n", > padding, "", propname, prop->data); > +} else if (fdt_prop_is_uint32_array(prop_size)) { &g

Re: [PATCH for-7.2 v2 09/20] hw/ppc: set machine->fdt in pnv_reset()

2022-08-07 Thread David Gibson
e if we issue a 'system_reset' via the > monitor. Right. I'm not certain about pnv, but on most platforms there's a way to trigger system_reset from the guest side as well. > I'll put a g_free(machine->fdt) before the assignment. > > > Daniel > > > > > >   Fred >

Re: [PATCH for-7.2 v2 01/20] hw/arm: do not free machine->fdt in arm_load_dtb()

2022-08-07 Thread David Gibson
e (reduce) the effective size of the dtb blob, so returning a 'size' value from above rather than the new value of fdt_totalsize(fdt) doesn't see right. I believe some of the other patches in the series have similar concerns. -- David Gibson| I'll have my music baroque, and

Re: [PATCH for-7.2 v2 10/20] hw/ppc: set machine->fdt in spapr machine

2022-08-07 Thread David Gibson
bove (by freeing spapr->fdt_blob). We set this > + * pointer to enable support for 'dumpdtb' and 'info fdt' > + * HMP commands. > + */ > +MACHINE(spapr)->fdt = fdt; > + > return H_SUCCESS; > } > -- 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 for-7.2 v2 14/20] qmp/hmp, device_tree.c: introduce dumpdtb

2022-08-07 Thread David Gibson
mu/device_tree.c > index 6ca3fad285..cd487ddd4d 100644 > --- a/softmmu/device_tree.c > +++ b/softmmu/device_tree.c > @@ -643,3 +643,21 @@ out: > g_free(propcells); > return ret; > } > + > +void qemu_fdt_qmp_dumpdtb(const char *filename, Error **errp) > +{ >

Re: [PATCH v2] target/ppc/kvm: Skip current and parent directories in kvmppc_find_cpu_dt

2022-07-12 Thread David Gibson
osas Reviewed-by: David Gibson and, I believe, mea culpa. > --- > v2: > - Skip current and parent directories. > > v1: > https://lore.kernel.org/qemu-devel/20220711193743.51456-1-muri...@linux.ibm.com/ > > target/ppc/kvm.c | 6 ++ > 1 file changed, 6 insertio

Re: [RFC PATCH] target/ppc: don't print TB in ppc_cpu_dump_state if it's not initialized

2022-07-12 Thread David Gibson
t; > + " DECR " TARGET_FMT_lu > > #endif > > - "\n", > > - cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env) > > + "\n", > > + cpu_ppc_load_tbu(en

Re: [PATCH] target/ppc/kvm: Skip ".." directory in kvmppc_find_cpu_dt

2022-07-12 Thread David Gibson
now, but it would be technically more correct to also skip ".", wouldn't it? > +continue; > +} > + > snprintf(buf, buf_len, "%s%s/clock-frequency", PROC_DEVTREE_CPU, > dirp->d_name); > f = fopen(buf, &

Re: [RFC 07/18] vfio: Add base object for VFIOContainer

2022-04-29 Thread David Gibson
On Thu, Apr 14, 2022 at 03:46:59AM -0700, Yi Liu wrote: > Qomify the VFIOContainer object which acts as a base class for a > container. This base class is derived into the legacy VFIO container > and later on, into the new iommufd based container. You certainly need the abstraction, but I'm not

Re: [PATCH for-7.1 1/1] hw/ppc: check if spapr_drc_index() returns NULL in spapr_nvdimm.c

2022-04-06 Thread David Gibson
not find nvdimm device with DRC 0x%u", > + state->drcidx); > +return; > +} > + > +s_nvdimm = SPAPR_NVDIMM(drc->dev); > > state->hcall_ret = hcall_ret; > QLIST_REMOVE(state, node); -- 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: [RFC PATCH 1/1] kvm-all.c: hint Valgrind that kvm_get_one_reg() inits memory

2022-04-06 Thread David Gibson
e is running QEMU with KVM enabled > under valgrind anyway? Valgrind has no way of knowing about > writes to memory that the guest vCPUs do... Those should be limited to the guest memory area though, which as mmap()ed space would already be considered initialized, I believe. If there's so

Re: [RFC PATCH 1/1] kvm-all.c: hint Valgrind that kvm_get_one_reg() inits memory

2022-04-06 Thread David Gibson
bring benefit for its other callers. > > This patch uses the memcheck VALGRING_MAKE_MEM_DEFINED() to mark the > 'target' variable as initialized if the ioctl is successful. > > Cc: Paolo Bonzini > Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson > --- > acc

Re: [PATCH v2 2/4] target/ppc: init 'lpcr' in kvmppc_enable_cap_large_decr()

2022-03-31 Thread David Gibson
that it > > covers all kvm hosts.  But it's too late to do this for 7.0. > > I wasn't planning on pushing these changes for 7.0 since they aren't fixing > mem > leaks or anything really bad. It's more of a quality of life improvement when > using Valgrind. > > I also

Re: [PATCH v2 2/4] target/ppc: init 'lpcr' in kvmppc_enable_cap_large_decr()

2022-03-31 Thread David Gibson
On Thu, Mar 31, 2022 at 02:17:42PM -0300, Daniel Henrique Barboza wrote: > > > On 3/30/22 22:25, David Gibson wrote: > > On Wed, Mar 30, 2022 at 09:17:15PM -0300, Daniel Henrique Barboza wrote: > > > 'lpcr' is used as an input of kvm_get_one_reg(). Valgrind

Re: [RFC PATCH 1/2] spapr: Report correct GTSE support via ov5

2022-03-30 Thread David Gibson
On Mon, Mar 14, 2022 at 07:10:10PM -0300, Fabiano Rosas wrote: > David Gibson writes: > > > On Tue, Mar 08, 2022 at 10:23:59PM -0300, Fabiano Rosas wrote: > >> QEMU reports MMU support to the guest via the ibm,architecture-vec-5 > >> property of the /chosen node.

Re: [PATCH v2 2/4] target/ppc: init 'lpcr' in kvmppc_enable_cap_large_decr()

2022-03-30 Thread David Gibson
nt64_t lpcr = 0; > > kvm_get_one_reg(cs, KVM_REG_PPC_LPCR_64, ); > /* Do we need to modify the LPCR? */ -- 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 v2 1/4] target/ppc: initialize 'val' union in kvm_get_one_spr()

2022-03-30 Thread David Gibson
at 0xB11F08: kvm_get_one_spr (kvm.c:543) > > Initializing 'val' has no impact in the logic and makes Valgrind output > more bearable. > > Reviewed-by: Philippe Mathieu-Daudé > Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson > --- > target/ppc/kvm.c | 3

Re: [PATCH v2 1/1] hw/ppc: free env->tb_env in spapr_unrealize_vcpu()

2022-03-29 Thread David Gibson
qdev_realize (qdev.c:333) > ==636935== > > This patch adds a cpu_ppc_tb_free() helper in hw/ppc/ppc.c to allow us > to free the timebase. This leak is then solved by calling > cpu_ppc_tb_free() in spapr_unrealize_vcpu(). > > Fixes: 6f4b5c3ec590 ("spapr: CPU hot unplug suppor

Re: [PATCH 0/2] ppc: fix vcpu hotunplug leak in spapr_realize_vcpu

2022-03-28 Thread David Gibson
ique Barboza (2): > hw/ppc/ppc.c: add cpu_ppc_tb_free() > hw/ppc: free env->tb_env in spapr_unrealize_vcpu() > > hw/ppc/ppc.c| 7 +++ > hw/ppc/spapr_cpu_core.c | 3 +++ > include/hw/ppc/ppc.h | 1 + > 3 files changed, 11 insertions(+) > -- Da

Re: [RFC PATCH 1/6] target/ppc: Add support for the Processor Attention instruction

2022-03-25 Thread David Gibson
;excp_model == POWERPC_EXCP_POWER10) { > > +attn = !!(env->spr[SPR_HID0] & HID0_POWER9_ATTN); > > +} > > The excp_model is not a CPU identifier. This should ideally be a flag > set during init_proc. Something like HID0_ATTN_P8/HID0_ATTN_P9. > &g

Re: [PATCH for-7.1 2/4] hw/ppc: use qdev to register physical DRC vmstates

2022-03-22 Thread David Gibson
vmsd = _spapr_drc_physical; > + > drck->dr_entity_sense = physical_entity_sense; > drck->isolate = drc_isolate_physical; > drck->unisolate = drc_unisolate_physical; -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropb

Re: [PATCH for-7.1 0/4] use dc->vmsd with spapr devices vmstate

2022-03-22 Thread David Gibson
tected when testing migration scenarios with > hotplug/unplug of devices. Looks good tome. -- 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

Re: [PATCH for-7.1 0/9] spapr: add drc->index, remove spapr_drc_index()

2022-03-21 Thread David Gibson
On Mon, Mar 21, 2022 at 04:58:47AM -0300, Daniel Henrique Barboza wrote: > > > On 3/21/22 00:55, David Gibson wrote: > > On Fri, Mar 18, 2022 at 02:33:11PM -0300, Daniel Henrique Barboza wrote: > > > Hi, > > > > > > I decided to make this chang

Re: [PATCH 1/3] spapr: Ignore nested KVM hypercalls when not running TCG

2022-03-21 Thread David Gibson
On Fri, Mar 18, 2022 at 10:41:19AM -0300, Fabiano Rosas wrote: > David Gibson writes: > > > On Thu, Mar 17, 2022 at 02:20:47PM -0300, Fabiano Rosas wrote: > >> It is possible that nested KVM hypercalls reach QEMU while we're > >> running KVM. The spapr vir

Re: [PATCH for-7.1 0/9] spapr: add drc->index, remove spapr_drc_index()

2022-03-20 Thread David Gibson
drc.c | 79 +++--- > hw/ppc/spapr_events.c | 4 +- > hw/ppc/spapr_nvdimm.c | 10 ++--- > hw/ppc/spapr_pci.c | 5 +-- > include/hw/ppc/spapr_drc.h | 2 +- > 6 files changed, 48 insertions(+), 70 deletions(-) > -- David

Re: Question about vmstate_register(), dc->vmsd and instance_id

2022-03-19 Thread David Gibson
On Fri, Mar 18, 2022 at 04:51:10PM -0300, Daniel Henrique Barboza wrote: > > > On 3/18/22 00:43, David Gibson wrote: > > On Thu, Mar 17, 2022 at 04:29:14PM +, Dr. David Alan Gilbert wrote: > > > * Peter Maydell (peter.mayd...@linaro.org) wrote: > > > >

Re: [PATCH 3/3] spapr: Move nested KVM hypercalls under a TCG only config.

2022-03-17 Thread David Gibson
(KVMPPC_H_UPDATE_DT, h_update_dt); > - > -spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl); > -spapr_register_hypercall(KVMPPC_H_ENTER_NESTED, h_enter_nested); > -spapr_register_hypercall(KVMPPC_H_TLB_INVALIDATE, h_tlb_invalidate); > -spapr_

Re: Question about vmstate_register(), dc->vmsd and instance_id

2022-03-17 Thread David Gibson
named by, then > the instance_id is used to uniquify them. Thanks for the information. I remember deciding at the time that just using vmsd wouldn't work for the DRCs because we needed this fixed index. At the time either qdev_set_legacy_instance_id() didn't exist, or I didn't know about it,

Re: [PATCH 1/3] spapr: Ignore nested KVM hypercalls when not running TCG

2022-03-17 Thread David Gibson
led()) { > + return H_FUNCTION; > +} > + > if (spapr->nested_ptcr == 0) { > return H_NOT_AVAILABLE; > } -- 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 v3 1/4] target/ppc: Fix masked PVR matching

2022-03-12 Thread David Gibson
t32_t pvr) > { > -if ((pvr & CPU_POWERPC_POWER_SERVER_MASK) == CPU_POWERPC_POWER10_BASE) { > +uint32_t base = pvr & CPU_POWERPC_POWER_SERVER_MASK; > +uint32_t pcc_base = pcc->pvr & CPU_POWERPC_POWER_SERVER_MASK; > + > +if (base != pcc_base) { > +

Re: [PATCH v3 2/4] target/ppc: Remove chip type field from POWER9 DD2.0 PVR

2022-03-12 Thread David Gibson
= 0x004E0200, > CPU_POWERPC_POWER10_BASE = 0x0080, > CPU_POWERPC_POWER10_DD1 = 0x00800100, > CPU_POWERPC_POWER10_DD20 = 0x00800200, -- David Gibson| I'll have my music baroque, and my code david AT gibson.dropbear.id.au | mi

Re: [RFC PATCH 1/2] spapr: Report correct GTSE support via ov5

2022-03-12 Thread David Gibson
a/target/ppc/kvm_ppc.h > +++ b/target/ppc/kvm_ppc.h > @@ -63,6 +63,7 @@ bool kvmppc_has_cap_fixup_hcalls(void); > bool kvmppc_has_cap_htm(void); > bool kvmppc_has_cap_mmu_radix(void); > bool kvmppc_has_cap_mmu_hash_v3(void); > +bool kvmppc_has_cap_gtse(void); > bool kvmppc_has_ca

Re: [PATCH 03/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_set_string()

2022-02-28 Thread David Gibson
On Mon, Feb 28, 2022 at 02:49:53PM -0300, Daniel Henrique Barboza wrote: > And get rid of the 'out' label since it's now used. s/used/unused/ > > Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson > --- > hw/ppc/spapr_caps.c | 8 +++- > 1 file changed,

Re: [PATCH 05/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_caps_add_properties()

2022-02-28 Thread David Gibson
On Mon, Feb 28, 2022 at 02:49:55PM -0300, Daniel Henrique Barboza wrote: > Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson > --- > hw/ppc/spapr_caps.c | 7 ++- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/hw/ppc/spapr_caps.c b/h

Re: [PATCH 04/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_get_string()

2022-02-28 Thread David Gibson
On Mon, Feb 28, 2022 at 02:49:54PM -0300, Daniel Henrique Barboza wrote: > Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson > --- > hw/ppc/spapr_caps.c | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/hw/ppc/spapr_caps.c b/h

Re: [PATCH 02/14] hw/ppc/spapr.c: fail early if no firmware found in machine_init()

2022-02-28 Thread David Gibson
e' pointer. > > Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson > --- > hw/ppc/spapr.c | 24 +++- > 1 file changed, 11 insertions(+), 13 deletions(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index c74543ace3..4cc204f90d 1

Re: [PATCH 01/14] hw/ppc/spapr.c: use g_autofree in spapr_dt_chosen()

2022-02-28 Thread David Gibson
On Mon, Feb 28, 2022 at 02:49:51PM -0300, Daniel Henrique Barboza wrote: > Signed-off-by: Daniel Henrique Barboza Reviewed-by: David Gibson > --- > hw/ppc/spapr.c | 7 ++- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/hw/ppc/spapr.c b/hw/p

  1   2   3   4   5   6   7   8   9   10   >