Re: [PATCH 8/9] bsd-user: implement sysctlbyname(2)

2023-02-11 Thread Kyle Evans
On Sat, Feb 11, 2023 at 5:13 PM Richard Henderson wrote: > > On 2/10/23 13:18, Warner Losh wrote: > > From: Kyle Evans > > > > do_freebsd_sysctlbyname needs to translate the 'name' back down to a OID > > so we can intercept the special ones. Do that and call the common wrapper > >

Re: [PATCH 4/9] bsd-user: Two helper routines oidfmt and sysctl_oldcvt

2023-02-11 Thread Warner Losh
On Sat, Feb 11, 2023 at 3:17 PM Richard Henderson < richard.hender...@linaro.org> wrote: > On 2/10/23 13:18, Warner Losh wrote: > > +static int sysctl_oldcvt(void *holdp, size_t *holdlen, uint32_t kind) > > +{ > > +switch (kind & CTLTYPE) { > > +case CTLTYPE_INT: > > +case

Re: [PATCH 6/9] bsd-user: common routine do_freebsd_sysctl_oid for all sysctl variants

2023-02-11 Thread Richard Henderson
On 2/11/23 14:40, Warner Losh wrote: I was going to do something like: +    if (host_page_size != TARGET_PAGE_SIZE) { +        if (host_page_size > TARGET_PAGE_SIZE) { +            /* Scale up */ +            pages *= host_page_size / TARGET_PAGE_SIZE; +        } else { +            /* Scale

Re: [PATCH 6/9] bsd-user: common routine do_freebsd_sysctl_oid for all sysctl variants

2023-02-11 Thread Warner Losh
On Sat, Feb 11, 2023 at 4:59 PM Richard Henderson < richard.hender...@linaro.org> wrote: > On 2/11/23 13:40, Warner Losh wrote: > > maxmem is defined earlier in this patch: > > > > +#if TARGET_ABI_BITS != HOST_LONG_BITS > > +const abi_ulong maxmem = -0x100c000; > > > > but I'm not at all sure

Re: [PATCH 1/2] hw/pci: Fix a typo

2023-02-11 Thread Richard Henderson
On 2/11/23 05:22, Philippe Mathieu-Daudé wrote: Fix 'interrutp' typo. Signed-off-by: Philippe Mathieu-Daudé --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [PATCH 3/3] hw/rtc: Rename rtc_[get|set]_memory -> mc146818rtc_[get|set]_cmos_data

2023-02-11 Thread Richard Henderson
On 2/10/23 13:31, Philippe Mathieu-Daudé wrote: rtc_get_memory() and rtc_set_memory() helpers only work with TYPE_MC146818_RTC devices. 'memory' in their name refer to the CMOS region. Rename them as mc146818rtc_get_cmos_data() and mc146818rtc_set_cmos_data() to be explicit about what they are

Re: [PATCH 2/3] hw/rtc/mc146818rtc: Pass MC146818RtcState instead of ISADevice argument

2023-02-11 Thread Richard Henderson
On 2/10/23 13:31, Philippe Mathieu-Daudé wrote: rtc_get_memory() and rtc_set_memory() methods can not take any TYPE_ISA_DEVICE object. They expect a TYPE_MC146818_RTC one. Simplify the API by passing a MC146818RtcState. Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/microvm.c|

Re: [PATCH 1/3] hw/rtc/mc146818rtc: Rename RTCState -> MC146818RtcState

2023-02-11 Thread Richard Henderson
On 2/10/23 13:31, Philippe Mathieu-Daudé wrote: RTCState only represents a Motorola MC146818 model, not any RTC chipset. Rename the structure as MC146818RtcState using: $ sed -i -e s/RTCState/MC146818RtcState/g $(git grep -wl RTCState) Signed-off-by: Philippe Mathieu-Daudé ---

Re: [PATCH 6/9] bsd-user: common routine do_freebsd_sysctl_oid for all sysctl variants

2023-02-11 Thread Richard Henderson
On 2/11/23 13:40, Warner Losh wrote: maxmem is defined earlier in this patch: +#if TARGET_ABI_BITS != HOST_LONG_BITS +    const abi_ulong maxmem = -0x100c000; but I'm not at all sure how that number was arrived at... It's a little less than ULONG_MAX is all I can say for sure. As to why it's

Re: [PATCH v4] hw/arm/smmuv3: Add GBPA register

2023-02-11 Thread Richard Henderson
On 2/10/23 12:19, Mostafa Saleh wrote: @@ -1512,6 +1553,10 @@ static const VMStateDescription vmstate_smmuv3 = { VMSTATE_END_OF_LIST(), }, +.subsections = (const VMStateDescription * []) { +_gbpa, +NULL +} Actually, I suspect that you need a pre_load

Re: [PATCH 6/9] bsd-user: common routine do_freebsd_sysctl_oid for all sysctl variants

2023-02-11 Thread Warner Losh
On Sat, Feb 11, 2023 at 3:56 PM Richard Henderson < richard.hender...@linaro.org> wrote: > On 2/10/23 13:18, Warner Losh wrote: > > +/* Handle some arch/emulator dependent sysctl()'s here. */ > > +switch (snamep[0]) { > > +#if defined(TARGET_PPC) || defined(TARGET_PPC64) > > +case

Re: [PATCH v4] hw/arm/smmuv3: Add GBPA register

2023-02-11 Thread Richard Henderson
On 2/10/23 12:19, Mostafa Saleh wrote: +static bool smmuv3_gbpa_needed(void *opaque) +{ +SMMUv3State *s = opaque; + +/* Only migrate GBPA if it has different reset value. */ +if (s->gbpa != SMMU_GBPA_RESET_VAL) { +return true; +} + +return false; Just "return

Re: [PATCH 2/2] hw/arm/smmu-common: Fix TTB1 handling

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Jean-Philippe Brucker wrote: Addresses targeting the second translation table (TTB1) in the SMMU have all upper bits set (except for the top byte when TBI is enabled). Fix the TTB1 check. Reported-by: Ola Hugosson Signed-off-by: Jean-Philippe Brucker --- hw/arm/smmu-common.c

Re: [PATCH 1/2] hw/arm/smmu-common: Support 64-bit addresses

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Jean-Philippe Brucker wrote: Addresses targeting the second translation table (TTB1) in the SMMU have all upper bits set. Ensure the IOMMU region covers all 64 bits. Signed-off-by: Jean-Philippe Brucker --- hw/arm/smmu-common.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: [PATCH 9/9] bsd-user: Add -strict

2023-02-11 Thread Richard Henderson
On 2/10/23 13:18, Warner Losh wrote: Most of the time, it's useful to make our best effort, but sometimes we want to know right away when we don't implement something. First place we use it is for unknown syscalls. Signed-off-by: Warner Losh --- bsd-user/freebsd/os-syscall.c | 4

Re: [PATCH 8/9] bsd-user: implement sysctlbyname(2)

2023-02-11 Thread Richard Henderson
On 2/10/23 13:18, Warner Losh wrote: From: Kyle Evans do_freebsd_sysctlbyname needs to translate the 'name' back down to a OID so we can intercept the special ones. Do that and call the common wrapper do_freebsd_sysctl_oid. Signed-off-by: Kyle Evans Signed-off-by: Warner Losh ---

Re: [PATCH 7/9] bsd-user: do_freebsd_sysctl helper for sysctl(2)

2023-02-11 Thread Richard Henderson
On 2/10/23 13:18, Warner Losh wrote: +abi_long do_freebsd_sysctl(CPUArchState *env, abi_ulong namep, int32_t namelen, +abi_ulong oldp, abi_ulong oldlenp, abi_ulong newp, abi_ulong newlen) +{ +abi_long ret; +void *hnamep, *holdp = NULL, *hnewp = NULL; +size_t holdlen; +

Re: [PATCH 6/9] bsd-user: common routine do_freebsd_sysctl_oid for all sysctl variants

2023-02-11 Thread Richard Henderson
On 2/10/23 13:18, Warner Losh wrote: +/* Handle some arch/emulator dependent sysctl()'s here. */ +switch (snamep[0]) { +#if defined(TARGET_PPC) || defined(TARGET_PPC64) +case CTL_MACHDEP: +switch (snamep[1]) { +case 1:/* CPU_CACHELINE */ +holdlen =

Re: [PATCH 0/9] 2023 Q1 bsd-user upstreaming: bugfixes and sysctl

2023-02-11 Thread Warner Losh
On Sat, Feb 11, 2023 at 12:30 PM Richard Henderson < richard.hender...@linaro.org> wrote: > On 2/10/23 13:18, Warner Losh wrote: > > There's > > several static functions that aren't used until the end of the patch > > series... Not sure the best way to suppress the build warnings there > (but

Re: [PATCH 4/9] bsd-user: Two helper routines oidfmt and sysctl_oldcvt

2023-02-11 Thread Richard Henderson
On 2/10/23 13:18, Warner Losh wrote: +static int sysctl_oldcvt(void *holdp, size_t *holdlen, uint32_t kind) +{ +switch (kind & CTLTYPE) { +case CTLTYPE_INT: +case CTLTYPE_UINT: +*(uint32_t *)holdp = tswap32(*(uint32_t *)holdp); +break; + +#ifdef TARGET_ABI32 +case

Re: [PATCH 0/9] 2023 Q1 bsd-user upstreaming: bugfixes and sysctl

2023-02-11 Thread Richard Henderson
On 2/10/23 13:18, Warner Losh wrote: There's several static functions that aren't used until the end of the patch series... Not sure the best way to suppress the build warnings there (but since they are just warnings...). Are they just warnings? --enable-werror is default... Anyway, I've

Re: [PATCH 3/9] bsd-user: Add sysarch syscall

2023-02-11 Thread Richard Henderson
On 2/10/23 13:18, Warner Losh wrote: From: Stacey Son Connect up the sysarch system call. Signed-off-by: Juergen Lock Co-authored-by: Juergen Lock Signed-off-by: Stacey Son Reviewed-by: Warner Losh Signed-off-by: Warner Losh --- bsd-user/freebsd/os-syscall.c | 7 +++ 1 file changed, 7

Re: [PATCH 1/9] bsd-user: Don't truncate the return value from freebsd_syscall

2023-02-11 Thread Richard Henderson
On 2/10/23 13:18, Warner Losh wrote: From: Doug Rabson System call return values on FreeBSD are in a register (which is spelled api_long in qemu). This was being assigned into an int variable which s/api/abi/ causes problems for 64bit targets. Resolves:

Re: [PATCH 11/11] hw/isa: Factor isa_bus_get_irq() out of isa_get_irq()

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Philippe Mathieu-Daudé wrote: isa_get_irq() was added in commit 3a38d437ca ("Add isa_reserve_irq()" Fri Aug 14 11:36:15 2009) as: a temporary interface to be used to allocate ISA IRQs for devices which have not yet been converted to qdev, and for special cases

Re: [PATCH 09/11] hw/isa: Rename isa_bus_irqs() -> isa_bus_register_input_irqs()

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Philippe Mathieu-Daudé wrote: isa_bus_irqs() register an array of input IRQs on the ISA bus. Rename it as isa_bus_register_input_irqs(). Mechanical change using: $ sed -i -e 's/isa_bus_irqs/isa_bus_register_input_irqs/g' \ $(git grep -wl isa_bus_irqs) Signed-off-by:

[PATCH] linux-user/mips: Low down switchable NaN2008 requirement

2023-02-11 Thread Jiaxun Yang
Previously switchable NaN2008 requires fcsr31.nan2008 to be writable for guest. However as per MIPS arch spec this bit can never be writable. This cause NaN2008 ELF to be rejected by QEMU. NaN2008 can be enabled on R2~R5 processors, just make it available unconditionally. Signed-off-by: Jiaxun

Re: [PATCH 07/11] hw/isa: Reorder to separate ISABus* vs ISADevice* functions

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Philippe Mathieu-Daudé wrote: Separate functions taking an ISABus* argument versus functions taking a ISADevice* one. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/isa.h | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) Reviewed-by: Richard

Re: [PATCH 06/11] hw/sparc64/sun4u: Keep reference to ISA input IRQs in EbusState

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Philippe Mathieu-Daudé wrote: Keep reference to ISA input IRQs in EbusState. To emphasize input/output distinction, rename arrays as isa_irqs_in / isa_irqs_out. Signed-off-by: Philippe Mathieu-Daudé --- hw/sparc64/sun4u.c | 12 ++-- 1 file changed, 6 insertions(+),

Re: [PATCH 05/11] hw/mips/jazz: Rename ISA input IRQs as 'isa_irqs_in'

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Philippe Mathieu-Daudé wrote: The following code: /* ISA devices */ i8259 = i8259_init(isa_bus, ...); gives the false idea that the function is creating a i8259 device. Instead this function returns an array of input IRQs. Rename the variable to clarify: /*

Re: [PATCH 03/11] hw/isa/i82378: Remove intermediate IRQ forwarder

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Philippe Mathieu-Daudé wrote: From: Philippe Mathieu-Daudé When the i82378 model was added in commit a04ff940974 ("prep: Add i82378 PCI-to-ISA bridge emulation") the i8259 model was not yet QOM'ified. This happened later in commit 747c70af78f ("i8259: Convert to qdev").

Re: [PATCH 02/11] hw/isa/i82378: Rename output IRQ as 'cpu_intr'

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Philippe Mathieu-Daudé wrote: Commit a04ff94097 ("prep: Add i82378 PCI-to-ISA bridge emulation") aimed to model the 2 output IRQs: CPU intr and NMI. Commit 5039d6e235 ("i8257: remove cpu_request_exit irq") removed the NMI IRQ. Since this model only use the CPU interrupt,

Re: [PATCH 01/11] hw/intc/i8259: Document i8259_init()

2023-02-11 Thread Richard Henderson
On 2/10/23 06:37, Philippe Mathieu-Daudé wrote: i8259_init() helper creates a i8259 device on an ISA bus, connects its IRQ output to the parent's input IRQ, and returns an array of 16 ISA input IRQs. Signed-off-by: Philippe Mathieu-Daudé --- hw/intc/i8259.c | 4 ++--

Re: [PATCH v6 00/33] Consolidate PIIX south bridges

2023-02-11 Thread Bernhard Beschow
Am 10. Februar 2023 17:11:06 UTC schrieb "Philippe Mathieu-Daudé" : >On 10/2/23 17:27, Bernhard Beschow wrote: >> >> >> Am 23. Januar 2023 15:51:49 UTC schrieb Bernhard Beschow : >>> >>> >>> Am 23. Januar 2023 09:25:51 UTC schrieb "Philippe Mathieu-Daudé" >>> : On 20/1/23 13:22,

[PATCH 2/2] hw/pci: Trace IRQ routing on PCI topology

2023-02-11 Thread Philippe Mathieu-Daudé
Trace how IRQ are rooted from EP to RC. Signed-off-by: Philippe Mathieu-Daudé --- hw/pci/pci.c| 8 hw/pci/trace-events | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 805e4b0c68..2e785e3aef 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@

[PATCH 0/2] hw/pci: Trace IRQ routing on PCI topology and fix a typo

2023-02-11 Thread Philippe Mathieu-Daudé
Add trace event to follow how IRQ are rooted from PCI EP to RC. Philippe Mathieu-Daudé (2): hw/pci: Fix a typo hw/pci: Trace IRQ routing on PCI topology hw/pci/pci.c| 10 +- hw/pci/trace-events | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) -- 2.38.1

[PATCH 1/2] hw/pci: Fix a typo

2023-02-11 Thread Philippe Mathieu-Daudé
Fix 'interrutp' typo. Signed-off-by: Philippe Mathieu-Daudé --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 208c16f450..805e4b0c68 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1648,7 +1648,7 @@ void

Re: [PATCH 02/11] target/riscv: allow users to actually write the MISA CSR

2023-02-11 Thread Daniel Henrique Barboza
On 2/10/23 23:43, weiwei wrote: On 2023/2/10 21:36, Daniel Henrique Barboza wrote: At this moment, and apparently since ever, we have no way of enabling RISCV_FEATURE_MISA. This means that all the code from write_misa(), all the nuts and bolts that handles how to properly write this CSR,

Re: [PATCH v3 3/7] qapi/expr: Split check_expr out from check_exprs

2023-02-11 Thread Markus Armbruster
John Snow writes: > --3b01fe05f45a096a > Content-Type: text/plain; charset="UTF-8" > > On Fri, Feb 10, 2023, 7:33 AM Markus Armbruster wrote: > >> Another observation... >> >> John Snow writes: >> >> > Primarily, this reduces a nesting level of a particularly long >> > block. It's