From 6f8ddc2a89ba3b4add7aa2b351c04d810795c3df Mon Sep 17 00:00:00 2001 From: Dov Murik Date: Tue, 3 Nov 2020 10:07:45 +0000 Subject: target/i386: tracing: format length values as hex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three trace events had a literal "0x" prefix but the 'len' values were formatted in decimal base. Keep the prefix and format the numbers as hex, as is usually the case for length of memory regions. Signed-off-by: Dov Murik Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20201103100745.160409-1-dovmurik@linux.vnet.ibm.com> Signed-off-by: Laurent Vivier --- target/i386/trace-events | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/i386/trace-events b/target/i386/trace-events index 9f299e94a2..246158ae1f 100644 --- a/target/i386/trace-events +++ b/target/i386/trace-events @@ -8,11 +8,11 @@ kvm_x86_update_msi_routes(int num) "Updated %d MSI routes" # sev.c kvm_sev_init(void) "" -kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%zu" -kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%zu" +kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%zx" +kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%zx" kvm_sev_change_state(const char *old, const char *new) "%s -> %s" kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p" -kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIu64 +kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIx64 kvm_sev_launch_measurement(const char *value) "data %s" kvm_sev_launch_finish(void) "" kvm_sev_launch_secret(uint64_t hpa, uint64_t hva, uint64_t secret, int len) "hpa 0x%" PRIx64 " hva 0x%" PRIx64 " data 0x%" PRIx64 " len %d" -- cgit v1.2.3 From fa647905e6baae9510e7ddcd640961bad60ba14c Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Sat, 21 Nov 2020 21:35:06 +0000 Subject: qemu-options.hx: Fix minor issues in icount documentation The documentation for the icount documentation has some minor issues: * in a couple of places it says "sleep=on|off" when in the context of the sentence it means specifically "sleep=on" * the synopsis line for the documentation has drifted out of sync with the synopsis line in the DEF() macro (used for "-help" output) * the synopsis line in the DEF() macro is missing a "][" between the sleep= part and the rr= part * the synopsis line doesn't indicate that rrsnapshot is an optional part of the rr=mode,rrfile=filename subgrouping * we don't document that sleep=on can't be used with shift=auto or align=on * the rr option description had some minor grammar and formatting errors and was a bit terse * in commit f1f4b57e88ff in 2015 the documentation of the sleep= suboption got added between the two paragraphs defining general behaviour of the icount option. This meant that the second paragraph talking about the behaviour of "this option" reads as if it's talking about sleep=on, when it's really describing -icount as a whole. The paragraph is better moved back up to above the sleep= section. * the summary text displayed in "-help" output didn't mention the record-and-replay part Fix these errors. Fixes: https://bugs.launchpad.net/qemu/+bug/1774412 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20201121213506.15599-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- qemu-options.hx | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index e60ad42976..ae8872d1d6 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3958,30 +3958,34 @@ SRST ERST DEF("icount", HAS_ARG, QEMU_OPTION_icount, \ - "-icount [shift=N|auto][,align=on|off][,sleep=on|off,rr=record|replay,rrfile=,rrsnapshot=]\n" \ + "-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=[,rrsnapshot=]]\n" \ " enable virtual instruction counter with 2^N clock ticks per\n" \ " instruction, enable aligning the host and virtual clocks\n" \ - " or disable real time cpu sleeping\n", QEMU_ARCH_ALL) + " or disable real time cpu sleeping, and optionally enable\n" \ + " record-and-replay mode\n", QEMU_ARCH_ALL) SRST -``-icount [shift=N|auto][,rr=record|replay,rrfile=filename,rrsnapshot=snapshot]`` +``-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=filename[,rrsnapshot=snapshot]]`` Enable virtual instruction counter. The virtual cpu will execute one instruction every 2^N ns of virtual time. If ``auto`` is specified then the virtual cpu speed will be automatically adjusted to keep virtual time within a few seconds of real time. - When the virtual cpu is sleeping, the virtual time will advance at - default speed unless ``sleep=on|off`` is specified. With - ``sleep=on|off``, the virtual time will jump to the next timer - deadline instantly whenever the virtual cpu goes to sleep mode and - will not advance if no timer is enabled. This behavior give - deterministic execution times from the guest point of view. - Note that while this option can give deterministic behavior, it does not provide cycle accurate emulation. Modern CPUs contain superscalar out of order cores with complex cache hierarchies. The number of instructions executed often has little or no correlation with actual performance. + When the virtual cpu is sleeping, the virtual time will advance at + default speed unless ``sleep=on`` is specified. With + ``sleep=on``, the virtual time will jump to the next timer + deadline instantly whenever the virtual cpu goes to sleep mode and + will not advance if no timer is enabled. This behavior gives + deterministic execution times from the guest point of view. + The default if icount is enabled is ``sleep=off``. + ``sleep=on`` cannot be used together with either ``shift=auto`` + or ``align=on``. + ``align=on`` will activate the delay algorithm which will try to synchronise the host clock and the virtual clock. The goal is to have a guest running at the real frequency imposed by the shift @@ -3991,15 +3995,17 @@ SRST ``shift`` is ``auto``. Note: The sync algorithm will work for those shift values for which the guest clock runs ahead of the host clock. Typically this happens when the shift value is high (how high - depends on the host machine). - - When ``rr`` option is specified deterministic record/replay is - enabled. Replay log is written into filename file in record mode and - read from this file in replay mode. - - Option rrsnapshot is used to create new vm snapshot named snapshot - at the start of execution recording. In replay mode this option is - used to load the initial VM state. + depends on the host machine). The default if icount is enabled + is ``align=off``. + + When the ``rr`` option is specified deterministic record/replay is + enabled. The ``rrfile=`` option must also be provided to + specify the path to the replay log. In record mode data is written + to this file, and in replay mode it is read back. + If the ``rrsnapshot`` option is given then it specifies a VM snapshot + name. In record mode, a new VM snapshot with the given name is created + at the start of execution recording. In replay mode this option + specifies the snapshot name used to load the initial VM state. ERST DEF("watchdog", HAS_ARG, QEMU_OPTION_watchdog, \ -- cgit v1.2.3 From 2f5f9bc88d54a3c702c854560331951a2820529c Mon Sep 17 00:00:00 2001 From: Michael Roth Date: Tue, 27 Oct 2020 01:02:53 -0500 Subject: MAINTAINERS: update my email address I've recently switched employers and the current email address is out of date. Signed-off-by: Michael Roth Reviewed-by: Thomas Huth Message-Id: <20201027060253.353054-1-michael.roth@amd.com> Signed-off-by: Laurent Vivier --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index d48a4e8a8b..f9d14078bc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2427,7 +2427,7 @@ F: scripts/simplebench/ QAPI M: Markus Armbruster -M: Michael Roth +M: Michael Roth S: Supported F: qapi/ X: qapi/*.json @@ -2471,7 +2471,7 @@ F: tests/data/qobject/qdict.txt T: git https://repo.or.cz/qemu/armbru.git qapi-next QEMU Guest Agent -M: Michael Roth +M: Michael Roth S: Maintained F: qga/ F: docs/interop/qemu-ga.rst -- cgit v1.2.3 From 01d152c0bfabadc6c93a39e465eb2f66f3f11527 Mon Sep 17 00:00:00 2001 From: Xinhao Zhang Date: Wed, 4 Nov 2020 21:37:09 +0800 Subject: hw/xen: Don't use '#' flag of printf format Fix code style. Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead Signed-off-by: Xinhao Zhang Signed-off-by: Kai Deng Message-Id: <20201104133709.3326630-1-zhangxinhao1@huawei.com> Signed-off-by: Laurent Vivier --- hw/xen/xen_pt.c | 10 +++++----- hw/xen/xen_pt_config_init.c | 6 +++--- hw/xen/xen_pt_msi.c | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 6d359ee486..a5f3dd590c 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -489,7 +489,7 @@ static int xen_pt_register_regions(XenPCIPassthroughState *s, uint16_t *cmd) pci_register_bar(&s->dev, i, type, &s->bar[i]); XEN_PT_LOG(&s->dev, "IO region %i registered (size=0x%08"PRIx64 - " base_addr=0x%08"PRIx64" type: %#x)\n", + " base_addr=0x%08"PRIx64" type: 0x%x)\n", i, r->size, r->base_addr, type); } @@ -578,7 +578,7 @@ static void xen_pt_check_bar_overlap(PCIBus *bus, PCIDevice *d, void *opaque) if (ranges_overlap(arg->addr, arg->size, r->addr, r->size)) { XEN_PT_WARN(&s->dev, "Overlapped to device [%02x:%02x.%d] Region: %i" - " (addr: %#"FMT_PCIBUS", len: %#"FMT_PCIBUS")\n", + " (addr: 0x%"FMT_PCIBUS", len: 0x%"FMT_PCIBUS")\n", pci_bus_num(bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), i, r->addr, r->size); arg->rc = true; @@ -618,8 +618,8 @@ static void xen_pt_region_update(XenPCIPassthroughState *s, pci_for_each_device(pci_get_bus(d), pci_dev_bus_num(d), xen_pt_check_bar_overlap, &args); if (args.rc) { - XEN_PT_WARN(d, "Region: %d (addr: %#"FMT_PCIBUS - ", len: %#"FMT_PCIBUS") is overlapped.\n", + XEN_PT_WARN(d, "Region: %d (addr: 0x%"FMT_PCIBUS + ", len: 0x%"FMT_PCIBUS") is overlapped.\n", bar, sec->offset_within_address_space, int128_get64(sec->size)); } @@ -786,7 +786,7 @@ static void xen_pt_realize(PCIDevice *d, Error **errp) /* register real device */ XEN_PT_LOG(d, "Assigning real physical device %02x:%02x.%d" - " to devfn %#x\n", + " to devfn 0x%x\n", s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function, s->dev.devfn); diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index c8724cc7c8..c5c4e943a8 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -1622,7 +1622,7 @@ static int xen_pt_pcie_size_init(XenPCIPassthroughState *s, case PCI_EXP_TYPE_PCIE_BRIDGE: case PCI_EXP_TYPE_RC_EC: default: - XEN_PT_ERR(d, "Unsupported device/port type %#x.\n", type); + XEN_PT_ERR(d, "Unsupported device/port type 0x%x.\n", type); return -1; } } @@ -1645,11 +1645,11 @@ static int xen_pt_pcie_size_init(XenPCIPassthroughState *s, case PCI_EXP_TYPE_PCIE_BRIDGE: case PCI_EXP_TYPE_RC_EC: default: - XEN_PT_ERR(d, "Unsupported device/port type %#x.\n", type); + XEN_PT_ERR(d, "Unsupported device/port type 0x%x.\n", type); return -1; } } else { - XEN_PT_ERR(d, "Unsupported capability version %#x.\n", version); + XEN_PT_ERR(d, "Unsupported capability version 0x%x.\n", version); return -1; } diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c index fb4b887b92..b71563f98a 100644 --- a/hw/xen/xen_pt_msi.c +++ b/hw/xen/xen_pt_msi.c @@ -123,7 +123,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s, *ppirq = XEN_PT_UNASSIGNED_PIRQ; } else { XEN_PT_LOG(&s->dev, "requested pirq %d for MSI%s" - " (vec: %#x, entry: %#x)\n", + " (vec: 0x%x, entry: 0x%x)\n", *ppirq, is_msix ? "-X" : "", gvec, msix_entry); } } @@ -142,7 +142,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s, msix_entry, table_base); if (rc) { XEN_PT_ERR(&s->dev, - "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n", + "Mapping of MSI%s (err: %i, vec: 0x%x, entry 0x%x)\n", is_msix ? "-X" : "", errno, gvec, msix_entry); return rc; } @@ -165,8 +165,8 @@ static int msi_msix_update(XenPCIPassthroughState *s, int rc = 0; uint64_t table_addr = 0; - XEN_PT_LOG(d, "Updating MSI%s with pirq %d gvec %#x gflags %#x" - " (entry: %#x)\n", + XEN_PT_LOG(d, "Updating MSI%s with pirq %d gvec 0x%x gflags 0x%x" + " (entry: 0x%x)\n", is_msix ? "-X" : "", pirq, gvec, gflags, msix_entry); if (is_msix) { @@ -208,11 +208,11 @@ static int msi_msix_disable(XenPCIPassthroughState *s, } if (is_binded) { - XEN_PT_LOG(d, "Unbind MSI%s with pirq %d, gvec %#x\n", + XEN_PT_LOG(d, "Unbind MSI%s with pirq %d, gvec 0x%x\n", is_msix ? "-X" : "", pirq, gvec); rc = xc_domain_unbind_msi_irq(xen_xc, xen_domid, gvec, pirq, gflags); if (rc) { - XEN_PT_ERR(d, "Unbinding of MSI%s failed. (err: %d, pirq: %d, gvec: %#x)\n", + XEN_PT_ERR(d, "Unbinding of MSI%s failed. (err: %d, pirq: %d, gvec: 0x%x)\n", is_msix ? "-X" : "", errno, pirq, gvec); return rc; } @@ -539,7 +539,7 @@ int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base) } if (id != PCI_CAP_ID_MSIX) { - XEN_PT_ERR(d, "Invalid id %#x base %#x\n", id, base); + XEN_PT_ERR(d, "Invalid id 0x%x base 0x%x\n", id, base); return -1; } @@ -582,7 +582,7 @@ int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base) XEN_PT_ERR(d, "Can't open /dev/mem: %s\n", strerror(errno)); goto error_out; } - XEN_PT_LOG(d, "table_off = %#x, total_entries = %d\n", + XEN_PT_LOG(d, "table_off = 0x%x, total_entries = %d\n", table_off, total_entries); msix->table_offset_adjust = table_off & 0x0fff; msix->phys_iomem_base = -- cgit v1.2.3 From f6a3c86ebd39aaedf1ebf89629ec91b5d44b670d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 2 Dec 2020 14:20:38 +0100 Subject: hw/pci-host/pam: Replace magic number by PAM_REGIONS_COUNT definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While this change helps triskaidekaphobic developers, it is a good practice to avoid magic values and using constant definitions instead. Introduce the PAM_REGIONS_COUNT and use it. No logical change. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Julia Suvorova Message-Id: <20201202132038.1276404-1-philmd@redhat.com> Signed-off-by: Laurent Vivier --- hw/pci-host/pam.c | 2 +- hw/pci-host/q35.c | 2 +- include/hw/pci-host/i440fx.h | 2 +- include/hw/pci-host/pam.h | 2 ++ include/hw/pci-host/q35.h | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index a496205783..454dd120db 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -62,7 +62,7 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory, void pam_update(PAMMemoryRegion *pam, int idx, uint8_t val) { - assert(0 <= idx && idx <= 12); + assert(0 <= idx && idx < PAM_REGIONS_COUNT); memory_region_set_enabled(&pam->alias[pam->current], false); pam->current = (val >> ((!(idx & 1)) * 4)) & PAM_ATTR_MASK; diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index b67cb9c29f..2eb729dff5 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -641,7 +641,7 @@ static void mch_realize(PCIDevice *d, Error **errp) init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space, &mch->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE); - for (i = 0; i < 12; ++i) { + for (i = 0; i < ARRAY_SIZE(mch->pam_regions) - 1; ++i) { init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space, &mch->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index 6c16eaf876..24fd53942c 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -29,7 +29,7 @@ struct PCII440FXState { MemoryRegion *system_memory; MemoryRegion *pci_address_space; MemoryRegion *ram_memory; - PAMMemoryRegion pam_regions[13]; + PAMMemoryRegion pam_regions[PAM_REGIONS_COUNT]; MemoryRegion smram_region; MemoryRegion smram, low_smram; }; diff --git a/include/hw/pci-host/pam.h b/include/hw/pci-host/pam.h index fec5cd35d6..c1fd06ba2a 100644 --- a/include/hw/pci-host/pam.h +++ b/include/hw/pci-host/pam.h @@ -80,6 +80,8 @@ #define SMRAM_C_BASE_SEG_MASK ((uint8_t)0x7) #define SMRAM_C_BASE_SEG ((uint8_t)0x2) /* hardwired to b010 */ +#define PAM_REGIONS_COUNT 13 + typedef struct PAMMemoryRegion { MemoryRegion alias[4]; /* index = PAM value */ unsigned current; diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index bbb9581765..ab989698ef 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -44,7 +44,7 @@ struct MCHPCIState { MemoryRegion *pci_address_space; MemoryRegion *system_memory; MemoryRegion *address_space_io; - PAMMemoryRegion pam_regions[13]; + PAMMemoryRegion pam_regions[PAM_REGIONS_COUNT]; MemoryRegion smram_region, open_high_smram; MemoryRegion smram, low_smram, high_smram; MemoryRegion tseg_blackhole, tseg_window; -- cgit v1.2.3 From 87b804ec4c05d793f9c6374b0e90ef2614bb5b25 Mon Sep 17 00:00:00 2001 From: zhouyang Date: Wed, 9 Dec 2020 14:07:35 +0800 Subject: fsdev: open brace '{' following struct go on the same line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I found some style problems while check the code using checkpatch.pl. This commit fixs the issue below: ERROR: open brace '{' following struct go on the same line Signed-off-by: zhouyang Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20201209060735.2760943-1-zhouyang789@huawei.com> Signed-off-by: Laurent Vivier --- fsdev/9p-marshal.h | 12 ++++-------- fsdev/file-op-9p.h | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/fsdev/9p-marshal.h b/fsdev/9p-marshal.h index 8f3babb60a..ceaf2f521e 100644 --- a/fsdev/9p-marshal.h +++ b/fsdev/9p-marshal.h @@ -1,21 +1,18 @@ #ifndef QEMU_9P_MARSHAL_H #define QEMU_9P_MARSHAL_H -typedef struct V9fsString -{ +typedef struct V9fsString { uint16_t size; char *data; } V9fsString; -typedef struct V9fsQID -{ +typedef struct V9fsQID { uint8_t type; uint32_t version; uint64_t path; } V9fsQID; -typedef struct V9fsStat -{ +typedef struct V9fsStat { int16_t size; int16_t type; int32_t dev; @@ -35,8 +32,7 @@ typedef struct V9fsStat int32_t n_muid; } V9fsStat; -typedef struct V9fsIattr -{ +typedef struct V9fsIattr { int32_t valid; int32_t mode; int32_t uid; diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index d51cec2f3b..42f677cf38 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -110,8 +110,7 @@ typedef union V9fsFidOpenState V9fsFidOpenState; void cred_init(FsCred *); -struct FileOperations -{ +struct FileOperations { int (*parse_opts)(QemuOpts *, FsDriverEntry *, Error **errp); int (*init)(FsContext *, Error **errp); void (*cleanup)(FsContext *); -- cgit v1.2.3 From a998de0dcd4dd62bd8aa4f7aad381ac36220b012 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 6 Nov 2020 11:29:40 +0000 Subject: CODING_STYLE.rst: Be less strict about 80 character limit Relax the wording about line lengths a little bit; this goes with the checkpatch changes to warn at 100 characters rather than 80. (Compare the Linux kernel commit bdc48fa11e46f8; our coding style is not theirs, but the rationale is good and applies to us too.) Signed-off-by: Peter Maydell Reviewed-by: Markus Armbruster Reviewed-by: Michael S. Tsirkin Message-Id: <20201106112940.31300-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- CODING_STYLE.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CODING_STYLE.rst b/CODING_STYLE.rst index 8b13ef0669..7bf4e39d48 100644 --- a/CODING_STYLE.rst +++ b/CODING_STYLE.rst @@ -85,8 +85,13 @@ Line width Lines should be 80 characters; try not to make them longer. Sometimes it is hard to do, especially when dealing with QEMU subsystems -that use long function or symbol names. Even in that case, do not make -lines much longer than 80 characters. +that use long function or symbol names. If wrapping the line at 80 columns +is obviously less readable and more awkward, prefer not to wrap it; better +to have an 85 character line than one which is awkwardly wrapped. + +Even in that case, try not to make lines much longer than 80 characters. +(The checkpatch script will warn at 100 characters, but this is intended +as a guard against obviously-overlength lines, not a target.) Rationale: -- cgit v1.2.3 From f12985f14a05181b34b3cfb935b4136a05726423 Mon Sep 17 00:00:00 2001 From: Gan Qixin Date: Sun, 15 Nov 2020 20:35:03 +0800 Subject: ads7846: moves from the hw/display folder to the hw/input folder. ads7846 is a touch-screen controller that is an input device rather than a display device, so move it to the hw/input folder. Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell Message-Id: <20201115123503.1110665-1-ganqixin@huawei.com> Signed-off-by: Laurent Vivier --- hw/arm/Kconfig | 2 +- hw/display/Kconfig | 3 - hw/display/ads7846.c | 186 ------------------------------------------------- hw/display/meson.build | 1 - hw/input/Kconfig | 3 + hw/input/ads7846.c | 186 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/input/meson.build | 1 + 7 files changed, 191 insertions(+), 191 deletions(-) delete mode 100644 hw/display/ads7846.c create mode 100644 hw/input/ads7846.c diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index eb8a8844cf..0a242e4c5d 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -156,7 +156,7 @@ config TOSA config SPITZ bool - select ADS7846 # display + select ADS7846 # touch-screen controller select MAX111X # A/D converter select WM8750 # audio codec select MAX7310 # GPIO expander diff --git a/hw/display/Kconfig b/hw/display/Kconfig index 15d59e10dc..ca46b5830e 100644 --- a/hw/display/Kconfig +++ b/hw/display/Kconfig @@ -9,9 +9,6 @@ config EDID config FW_CFG_DMA bool -config ADS7846 - bool - config VGA_CIRRUS bool default y if PCI_DEVICES diff --git a/hw/display/ads7846.c b/hw/display/ads7846.c deleted file mode 100644 index 1d4e04a2dc..0000000000 --- a/hw/display/ads7846.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * TI ADS7846 / TSC2046 chip emulation. - * - * Copyright (c) 2006 Openedhand Ltd. - * Written by Andrzej Zaborowski - * - * This code is licensed under the GNU GPL v2. - * - * Contributions after 2012-01-13 are licensed under the terms of the - * GNU GPL, version 2 or (at your option) any later version. - */ - -#include "qemu/osdep.h" -#include "hw/irq.h" -#include "hw/ssi/ssi.h" -#include "migration/vmstate.h" -#include "qemu/module.h" -#include "ui/console.h" -#include "qom/object.h" - -struct ADS7846State { - SSIPeripheral ssidev; - qemu_irq interrupt; - - int input[8]; - int pressure; - int noise; - - int cycle; - int output; -}; - -#define TYPE_ADS7846 "ads7846" -OBJECT_DECLARE_SIMPLE_TYPE(ADS7846State, ADS7846) - -/* Control-byte bitfields */ -#define CB_PD0 (1 << 0) -#define CB_PD1 (1 << 1) -#define CB_SER (1 << 2) -#define CB_MODE (1 << 3) -#define CB_A0 (1 << 4) -#define CB_A1 (1 << 5) -#define CB_A2 (1 << 6) -#define CB_START (1 << 7) - -#define X_AXIS_DMAX 3470 -#define X_AXIS_MIN 290 -#define Y_AXIS_DMAX 3450 -#define Y_AXIS_MIN 200 - -#define ADS_VBAT 2000 -#define ADS_VAUX 2000 -#define ADS_TEMP0 2000 -#define ADS_TEMP1 3000 -#define ADS_XPOS(x, y) (X_AXIS_MIN + ((X_AXIS_DMAX * (x)) >> 15)) -#define ADS_YPOS(x, y) (Y_AXIS_MIN + ((Y_AXIS_DMAX * (y)) >> 15)) -#define ADS_Z1POS(x, y) 600 -#define ADS_Z2POS(x, y) (600 + 6000 / ADS_XPOS(x, y)) - -static void ads7846_int_update(ADS7846State *s) -{ - if (s->interrupt) - qemu_set_irq(s->interrupt, s->pressure == 0); -} - -static uint32_t ads7846_transfer(SSIPeripheral *dev, uint32_t value) -{ - ADS7846State *s = ADS7846(dev); - - switch (s->cycle ++) { - case 0: - if (!(value & CB_START)) { - s->cycle = 0; - break; - } - - s->output = s->input[(value >> 4) & 7]; - - /* Imitate the ADC noise, some drivers expect this. */ - s->noise = (s->noise + 3) & 7; - switch ((value >> 4) & 7) { - case 1: s->output += s->noise ^ 2; break; - case 3: s->output += s->noise ^ 0; break; - case 4: s->output += s->noise ^ 7; break; - case 5: s->output += s->noise ^ 5; break; - } - - if (value & CB_MODE) - s->output >>= 4; /* 8 bits instead of 12 */ - - break; - case 1: - s->cycle = 0; - break; - } - return s->output; -} - -static void ads7846_ts_event(void *opaque, - int x, int y, int z, int buttons_state) -{ - ADS7846State *s = opaque; - - if (buttons_state) { - x = 0x7fff - x; - s->input[1] = ADS_XPOS(x, y); - s->input[3] = ADS_Z1POS(x, y); - s->input[4] = ADS_Z2POS(x, y); - s->input[5] = ADS_YPOS(x, y); - } - - if (s->pressure == !buttons_state) { - s->pressure = !!buttons_state; - - ads7846_int_update(s); - } -} - -static int ads7856_post_load(void *opaque, int version_id) -{ - ADS7846State *s = opaque; - - s->pressure = 0; - ads7846_int_update(s); - return 0; -} - -static const VMStateDescription vmstate_ads7846 = { - .name = "ads7846", - .version_id = 1, - .minimum_version_id = 1, - .post_load = ads7856_post_load, - .fields = (VMStateField[]) { - VMSTATE_SSI_PERIPHERAL(ssidev, ADS7846State), - VMSTATE_INT32_ARRAY(input, ADS7846State, 8), - VMSTATE_INT32(noise, ADS7846State), - VMSTATE_INT32(cycle, ADS7846State), - VMSTATE_INT32(output, ADS7846State), - VMSTATE_END_OF_LIST() - } -}; - -static void ads7846_realize(SSIPeripheral *d, Error **errp) -{ - DeviceState *dev = DEVICE(d); - ADS7846State *s = ADS7846(d); - - qdev_init_gpio_out(dev, &s->interrupt, 1); - - s->input[0] = ADS_TEMP0; /* TEMP0 */ - s->input[2] = ADS_VBAT; /* VBAT */ - s->input[6] = ADS_VAUX; /* VAUX */ - s->input[7] = ADS_TEMP1; /* TEMP1 */ - - /* We want absolute coordinates */ - qemu_add_mouse_event_handler(ads7846_ts_event, s, 1, - "QEMU ADS7846-driven Touchscreen"); - - ads7846_int_update(s); - - vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_ads7846, s); -} - -static void ads7846_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - SSIPeripheralClass *k = SSI_PERIPHERAL_CLASS(klass); - - k->realize = ads7846_realize; - k->transfer = ads7846_transfer; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); -} - -static const TypeInfo ads7846_info = { - .name = TYPE_ADS7846, - .parent = TYPE_SSI_PERIPHERAL, - .instance_size = sizeof(ADS7846State), - .class_init = ads7846_class_init, -}; - -static void ads7846_register_types(void) -{ - type_register_static(&ads7846_info); -} - -type_init(ads7846_register_types) diff --git a/hw/display/meson.build b/hw/display/meson.build index dad3bd2b41..9d79e3951d 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -6,7 +6,6 @@ softmmu_ss.add(when: 'CONFIG_EDID', if_true: files('edid-generate.c', 'edid-regi softmmu_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb.c')) softmmu_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb-standalone.c')) -softmmu_ss.add(when: 'CONFIG_ADS7846', if_true: files('ads7846.c')) softmmu_ss.add(when: 'CONFIG_VGA_CIRRUS', if_true: files('cirrus_vga.c')) softmmu_ss.add(when: ['CONFIG_VGA_CIRRUS', 'CONFIG_VGA_ISA'], if_true: files('cirrus_vga_isa.c')) softmmu_ss.add(when: 'CONFIG_G364FB', if_true: files('g364fb.c')) diff --git a/hw/input/Kconfig b/hw/input/Kconfig index 64f14daabf..55865bb386 100644 --- a/hw/input/Kconfig +++ b/hw/input/Kconfig @@ -1,6 +1,9 @@ config ADB bool +config ADS7846 + bool + config LM832X bool depends on I2C diff --git a/hw/input/ads7846.c b/hw/input/ads7846.c new file mode 100644 index 0000000000..1d4e04a2dc --- /dev/null +++ b/hw/input/ads7846.c @@ -0,0 +1,186 @@ +/* + * TI ADS7846 / TSC2046 chip emulation. + * + * Copyright (c) 2006 Openedhand Ltd. + * Written by Andrzej Zaborowski + * + * This code is licensed under the GNU GPL v2. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" +#include "hw/irq.h" +#include "hw/ssi/ssi.h" +#include "migration/vmstate.h" +#include "qemu/module.h" +#include "ui/console.h" +#include "qom/object.h" + +struct ADS7846State { + SSIPeripheral ssidev; + qemu_irq interrupt; + + int input[8]; + int pressure; + int noise; + + int cycle; + int output; +}; + +#define TYPE_ADS7846 "ads7846" +OBJECT_DECLARE_SIMPLE_TYPE(ADS7846State, ADS7846) + +/* Control-byte bitfields */ +#define CB_PD0 (1 << 0) +#define CB_PD1 (1 << 1) +#define CB_SER (1 << 2) +#define CB_MODE (1 << 3) +#define CB_A0 (1 << 4) +#define CB_A1 (1 << 5) +#define CB_A2 (1 << 6) +#define CB_START (1 << 7) + +#define X_AXIS_DMAX 3470 +#define X_AXIS_MIN 290 +#define Y_AXIS_DMAX 3450 +#define Y_AXIS_MIN 200 + +#define ADS_VBAT 2000 +#define ADS_VAUX 2000 +#define ADS_TEMP0 2000 +#define ADS_TEMP1 3000 +#define ADS_XPOS(x, y) (X_AXIS_MIN + ((X_AXIS_DMAX * (x)) >> 15)) +#define ADS_YPOS(x, y) (Y_AXIS_MIN + ((Y_AXIS_DMAX * (y)) >> 15)) +#define ADS_Z1POS(x, y) 600 +#define ADS_Z2POS(x, y) (600 + 6000 / ADS_XPOS(x, y)) + +static void ads7846_int_update(ADS7846State *s) +{ + if (s->interrupt) + qemu_set_irq(s->interrupt, s->pressure == 0); +} + +static uint32_t ads7846_transfer(SSIPeripheral *dev, uint32_t value) +{ + ADS7846State *s = ADS7846(dev); + + switch (s->cycle ++) { + case 0: + if (!(value & CB_START)) { + s->cycle = 0; + break; + } + + s->output = s->input[(value >> 4) & 7]; + + /* Imitate the ADC noise, some drivers expect this. */ + s->noise = (s->noise + 3) & 7; + switch ((value >> 4) & 7) { + case 1: s->output += s->noise ^ 2; break; + case 3: s->output += s->noise ^ 0; break; + case 4: s->output += s->noise ^ 7; break; + case 5: s->output += s->noise ^ 5; break; + } + + if (value & CB_MODE) + s->output >>= 4; /* 8 bits instead of 12 */ + + break; + case 1: + s->cycle = 0; + break; + } + return s->output; +} + +static void ads7846_ts_event(void *opaque, + int x, int y, int z, int buttons_state) +{ + ADS7846State *s = opaque; + + if (buttons_state) { + x = 0x7fff - x; + s->input[1] = ADS_XPOS(x, y); + s->input[3] = ADS_Z1POS(x, y); + s->input[4] = ADS_Z2POS(x, y); + s->input[5] = ADS_YPOS(x, y); + } + + if (s->pressure == !buttons_state) { + s->pressure = !!buttons_state; + + ads7846_int_update(s); + } +} + +static int ads7856_post_load(void *opaque, int version_id) +{ + ADS7846State *s = opaque; + + s->pressure = 0; + ads7846_int_update(s); + return 0; +} + +static const VMStateDescription vmstate_ads7846 = { + .name = "ads7846", + .version_id = 1, + .minimum_version_id = 1, + .post_load = ads7856_post_load, + .fields = (VMStateField[]) { + VMSTATE_SSI_PERIPHERAL(ssidev, ADS7846State), + VMSTATE_INT32_ARRAY(input, ADS7846State, 8), + VMSTATE_INT32(noise, ADS7846State), + VMSTATE_INT32(cycle, ADS7846State), + VMSTATE_INT32(output, ADS7846State), + VMSTATE_END_OF_LIST() + } +}; + +static void ads7846_realize(SSIPeripheral *d, Error **errp) +{ + DeviceState *dev = DEVICE(d); + ADS7846State *s = ADS7846(d); + + qdev_init_gpio_out(dev, &s->interrupt, 1); + + s->input[0] = ADS_TEMP0; /* TEMP0 */ + s->input[2] = ADS_VBAT; /* VBAT */ + s->input[6] = ADS_VAUX; /* VAUX */ + s->input[7] = ADS_TEMP1; /* TEMP1 */ + + /* We want absolute coordinates */ + qemu_add_mouse_event_handler(ads7846_ts_event, s, 1, + "QEMU ADS7846-driven Touchscreen"); + + ads7846_int_update(s); + + vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_ads7846, s); +} + +static void ads7846_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + SSIPeripheralClass *k = SSI_PERIPHERAL_CLASS(klass); + + k->realize = ads7846_realize; + k->transfer = ads7846_transfer; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); +} + +static const TypeInfo ads7846_info = { + .name = TYPE_ADS7846, + .parent = TYPE_SSI_PERIPHERAL, + .instance_size = sizeof(ADS7846State), + .class_init = ads7846_class_init, +}; + +static void ads7846_register_types(void) +{ + type_register_static(&ads7846_info); +} + +type_init(ads7846_register_types) diff --git a/hw/input/meson.build b/hw/input/meson.build index e7285b15ae..0042c3f0dc 100644 --- a/hw/input/meson.build +++ b/hw/input/meson.build @@ -1,5 +1,6 @@ softmmu_ss.add(files('hid.c')) softmmu_ss.add(when: 'CONFIG_ADB', if_true: files('adb.c', 'adb-mouse.c', 'adb-kbd.c')) +softmmu_ss.add(when: 'CONFIG_ADS7846', if_true: files('ads7846.c')) softmmu_ss.add(when: 'CONFIG_LM832X', if_true: files('lm832x.c')) softmmu_ss.add(when: 'CONFIG_PCKBD', if_true: files('pckbd.c')) softmmu_ss.add(when: 'CONFIG_PL050', if_true: files('pl050.c')) -- cgit v1.2.3 From 8e2c76bd3ff2e81738195bdcc6bfdb8b2ddc7649 Mon Sep 17 00:00:00 2001 From: Roman Bolshakov Date: Tue, 25 Aug 2020 23:27:55 +0300 Subject: configure: Test if $make actually exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit configure doesn't detect if $make is installed on the build host. This is also helpful for hosts where an alias for make is used, i.e. configure would fail if gmake is not present on macOS. Reviewed-by: Daniel P. Berrangé Signed-off-by: Roman Bolshakov Reviewed-by: Thomas Huth Message-Id: <20200825202755.50626-5-r.bolshakov@yadro.com> Signed-off-by: Laurent Vivier --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 3f823ed163..c20ed86ff3 100755 --- a/configure +++ b/configure @@ -1875,6 +1875,10 @@ if test -z "$python" then error_exit "Python not found. Use --python=/path/to/python" fi +if ! has "$make" +then + error_exit "GNU make ($make) not found" +fi # Note that if the Python conditional here evaluates True we will exit # with status 1 which is a shell 'false' value. -- cgit v1.2.3 From 514284d73d09910451bf00640ee52088e71dbc4b Mon Sep 17 00:00:00 2001 From: Pan Nengyuan Date: Fri, 23 Oct 2020 14:12:14 +0800 Subject: elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_init Missing g_error_free in QEMU_Elf_init() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Viktor Prutyanov Reviewed-by: Li Qiang Signed-off-by: Chen Qun Reviewed-by: Thomas Huth Message-Id: <20201023061218.2080844-4-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier --- contrib/elf2dmp/qemu_elf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index 0db7816586..b601b6d7ba 100644 --- a/contrib/elf2dmp/qemu_elf.c +++ b/contrib/elf2dmp/qemu_elf.c @@ -126,6 +126,7 @@ int QEMU_Elf_init(QEMU_Elf *qe, const char *filename) qe->gmf = g_mapped_file_new(filename, TRUE, &gerr); if (gerr) { eprintf("Failed to map ELF dump file \'%s\'\n", filename); + g_error_free(gerr); return 1; } -- cgit v1.2.3 From 0c4c8671d79023a05d916e73d9b4399abff9c0a0 Mon Sep 17 00:00:00 2001 From: Pan Nengyuan Date: Fri, 23 Oct 2020 14:12:15 +0800 Subject: elf2dmp/pdb: Plug memleak in pdb_init_from_file Missing g_error_free in pdb_init_from_file() error path. Fix that. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Viktor Prutyanov Reviewed-by: Li Qiang Signed-off-by: Chen Qun Reviewed-by: Thomas Huth Message-Id: <20201023061218.2080844-5-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier --- contrib/elf2dmp/pdb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index a5bd40c99d..b3a6547068 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp/pdb.c @@ -285,6 +285,7 @@ int pdb_init_from_file(const char *name, struct pdb_reader *reader) reader->gmf = g_mapped_file_new(name, TRUE, &gerr); if (gerr) { eprintf("Failed to map PDB file \'%s\'\n", name); + g_error_free(gerr); return 1; } -- cgit v1.2.3 From cb8d0851f1c00daafd736757a22f4820ec081b68 Mon Sep 17 00:00:00 2001 From: Pan Nengyuan Date: Fri, 23 Oct 2020 14:12:18 +0800 Subject: block/file-posix: fix a possible undefined behavior local_err is not initialized to NULL, it will cause a assert error as below: qemu/util/error.c:59: error_setv: Assertion `*errp == NULL' failed. Fixes: c6447510690 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Stefano Garzarella Reviewed-by: Kevin Wolf Reviewed-by: Li Qiang Signed-off-by: Chen Qun Message-Id: <20201023061218.2080844-8-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier --- block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 83e2cc5530..9804681d5c 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2111,7 +2111,7 @@ static void raw_aio_attach_aio_context(BlockDriverState *bs, #endif #ifdef CONFIG_LINUX_IO_URING if (s->use_linux_io_uring) { - Error *local_err; + Error *local_err = NULL; if (!aio_setup_linux_io_uring(new_context, &local_err)) { error_reportf_err(local_err, "Unable to use linux io_uring, " "falling back to thread pool: "); -- cgit v1.2.3 From 94237657af9ac7af6bc9fa0c5d9f0af1a39adb45 Mon Sep 17 00:00:00 2001 From: Pan Nengyuan Date: Fri, 23 Oct 2020 14:12:17 +0800 Subject: blockdev: Fix a memleak in drive_backup_prepare() 'local_err' seems forgot to propagate in error path, it'll cause a memleak. Fix it. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Kevin Wolf Reviewed-by: Li Qiang Signed-off-by: Chen Qun Message-Id: <20201023061218.2080844-7-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier --- blockdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/blockdev.c b/blockdev.c index 412354b4b6..2431448c5d 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1827,6 +1827,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) if (set_backing_hd) { bdrv_set_backing_hd(target_bs, source, &local_err); if (local_err) { + error_propagate(errp, local_err); goto unref; } } -- cgit v1.2.3 From 5a42999b1f982873f32c02e7f712a2bd89135cc6 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 18 Nov 2020 18:10:47 +0100 Subject: configure: Remove the obsolete check for ifaddrs.h The code that used HAVE_IFADDRS_H has been removed in commit 0a27af918b ("io: use bind() to check for IPv4/6 availability"), so we don't need this check in the configure script anymore. Signed-off-by: Thomas Huth Reviewed-by: Richard Henderson Message-Id: <20201118171052.308191-2-thuth@redhat.com> Signed-off-by: Laurent Vivier --- configure | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/configure b/configure index c20ed86ff3..1df5c84811 100755 --- a/configure +++ b/configure @@ -3107,14 +3107,6 @@ EOF fi fi -########################################## -# getifaddrs (for tests/test-io-channel-socket ) - -have_ifaddrs_h=yes -if ! check_include "ifaddrs.h" ; then - have_ifaddrs_h=no -fi - ######################################### # libdrm check have_drm_h=no @@ -6219,9 +6211,6 @@ fi if test "$auth_pam" = "yes" ; then echo "CONFIG_AUTH_PAM=y" >> $config_host_mak fi -if test "$have_ifaddrs_h" = "yes" ; then - echo "HAVE_IFADDRS_H=y" >> $config_host_mak -fi if test "$have_drm_h" = "yes" ; then echo "HAVE_DRM_H=y" >> $config_host_mak fi -- cgit v1.2.3 From 2802d91d515f3e51a8b3515a35e79c2c676da9e5 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 18 Nov 2020 18:10:48 +0100 Subject: configure / meson: Move check for pty.h to meson.build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This check can be done in a much shorter way in meson.build Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20201118171052.308191-3-thuth@redhat.com> Signed-off-by: Laurent Vivier --- configure | 9 --------- meson.build | 1 + 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/configure b/configure index 1df5c84811..39e61b2758 100755 --- a/configure +++ b/configure @@ -2332,12 +2332,6 @@ else l2tpv3=no fi -if check_include "pty.h" ; then - pty_h=yes -else - pty_h=no -fi - cat > $TMPC < int main(int argc, char *argv[]) { @@ -6687,9 +6681,6 @@ if test "$sheepdog" = "yes" ; then add_to deprecated_features "sheepdog" echo "CONFIG_SHEEPDOG=y" >> $config_host_mak fi -if test "$pty_h" = "yes" ; then - echo "HAVE_PTY_H=y" >> $config_host_mak -fi if test "$have_mlockall" = "yes" ; then echo "HAVE_MLOCKALL=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index f344b25955..ef053c9837 100644 --- a/meson.build +++ b/meson.build @@ -836,6 +836,7 @@ config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0] config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) +config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target -- cgit v1.2.3 From 2964be527aecc10c89d7d99d186a2c36333d5e87 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 18 Nov 2020 18:10:49 +0100 Subject: configure / meson: Move check for drm.h to meson.build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This check can be done in a much shorter way in meson.build Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20201118171052.308191-4-thuth@redhat.com> Signed-off-by: Laurent Vivier --- configure | 10 ---------- meson.build | 1 + 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/configure b/configure index 39e61b2758..ec2fae9e09 100755 --- a/configure +++ b/configure @@ -3101,13 +3101,6 @@ EOF fi fi -######################################### -# libdrm check -have_drm_h=no -if check_include "libdrm/drm.h" ; then - have_drm_h=yes -fi - ######################################### # sys/signal.h check have_sys_signal_h=no @@ -6205,9 +6198,6 @@ fi if test "$auth_pam" = "yes" ; then echo "CONFIG_AUTH_PAM=y" >> $config_host_mak fi -if test "$have_drm_h" = "yes" ; then - echo "HAVE_DRM_H=y" >> $config_host_mak -fi if test "$have_broken_size_max" = "yes" ; then echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index ef053c9837..fc7ae6f868 100644 --- a/meson.build +++ b/meson.build @@ -836,6 +836,7 @@ config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0] config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) +config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) -- cgit v1.2.3 From 88c78f162a564ae17b3369b88c85e567d98ff9c7 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 18 Nov 2020 18:10:50 +0100 Subject: configure / meson: Move check for sys/signal.h to meson.build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This check can be done in a much shorter way in meson.build Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20201118171052.308191-5-thuth@redhat.com> Signed-off-by: Laurent Vivier --- configure | 10 ---------- meson.build | 1 + 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/configure b/configure index ec2fae9e09..4f0f9c99d3 100755 --- a/configure +++ b/configure @@ -3101,13 +3101,6 @@ EOF fi fi -######################################### -# sys/signal.h check -have_sys_signal_h=no -if check_include "sys/signal.h" ; then - have_sys_signal_h=yes -fi - ########################################## # VTE probe @@ -6204,9 +6197,6 @@ fi if test "$have_openpty" = "yes" ; then echo "HAVE_OPENPTY=y" >> $config_host_mak fi -if test "$have_sys_signal_h" = "yes" ; then - echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak -fi # Work around a system header bug with some kernel/XFS header # versions where they both try to define 'struct fsxattr': diff --git a/meson.build b/meson.build index fc7ae6f868..a790cc527c 100644 --- a/meson.build +++ b/meson.build @@ -839,6 +839,7 @@ config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2] config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) +config_host_data.set('HAVE_SYS_SIGNAL_H', cc.has_header('sys/signal.h')) ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] -- cgit v1.2.3 From 4a9d5f895adc25f043a382a3d5bf7237905d8991 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 18 Nov 2020 18:10:51 +0100 Subject: configure / meson: Move check for sys/kcov.h to meson.build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This check can be done in a much shorter way in meson.build. And while we're at it, rename the #define to HAVE_SYS_KCOV_H to match the other HAVE_someheader_H symbols that we already have. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20201118171052.308191-6-thuth@redhat.com> [lv: s/signal/kcov/] Signed-off-by: Laurent Vivier --- configure | 9 --------- linux-user/ioctls.h | 2 +- linux-user/syscall.c | 2 +- meson.build | 1 + 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 4f0f9c99d3..6c13964b24 100755 --- a/configure +++ b/configure @@ -4402,12 +4402,6 @@ if compile_prog "" "" ; then syncfs=yes fi -# check for kcov support (kernel must be 4.4+, compiled with certain options) -kcov=no -if check_include sys/kcov.h ; then - kcov=yes -fi - # check for btrfs filesystem support (kernel must be 3.9+) btrfs=no if check_include linux/btrfs.h ; then @@ -6112,9 +6106,6 @@ fi if test "$syncfs" = "yes" ; then echo "CONFIG_SYNCFS=y" >> $config_host_mak fi -if test "$kcov" = "yes" ; then - echo "CONFIG_KCOV=y" >> $config_host_mak -fi if test "$btrfs" = "yes" ; then echo "CONFIG_BTRFS=y" >> $config_host_mak fi diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index 585874f090..8efb4d38c0 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -715,7 +715,7 @@ IOCTL_IGNORE(TIOCSTOP) #endif -#ifdef CONFIG_KCOV +#ifdef HAVE_SYS_KCOV_H IOCTL(KCOV_ENABLE, 0, TYPE_NULL) IOCTL(KCOV_DISABLE, 0, TYPE_NULL) IOCTL(KCOV_INIT_TRACE, IOC_R, TYPE_ULONG) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 27adee908e..063130be04 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -73,7 +73,7 @@ #ifdef CONFIG_SENDFILE #include #endif -#ifdef CONFIG_KCOV +#ifdef HAVE_SYS_KCOV_H #include #endif diff --git a/meson.build b/meson.build index a790cc527c..04cdea75dd 100644 --- a/meson.build +++ b/meson.build @@ -839,6 +839,7 @@ config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2] config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) +config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) config_host_data.set('HAVE_SYS_SIGNAL_H', cc.has_header('sys/signal.h')) ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target -- cgit v1.2.3 From 48f670ecfcbe92f63475c516aefb6e217f469bbf Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 18 Nov 2020 18:10:52 +0100 Subject: configure / meson: Move check for linux/btrfs.h to meson.build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This check can be done in a much shorter way in meson.build. And while we're at it, rename the #define to HAVE_BTRFS_H to match the other HAVE_someheader_H symbols that we already have. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20201118171052.308191-7-thuth@redhat.com> Signed-off-by: Laurent Vivier --- configure | 9 --------- linux-user/syscall.c | 2 +- linux-user/syscall_defs.h | 2 +- meson.build | 1 + 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 6c13964b24..cb21108d34 100755 --- a/configure +++ b/configure @@ -4402,12 +4402,6 @@ if compile_prog "" "" ; then syncfs=yes fi -# check for btrfs filesystem support (kernel must be 3.9+) -btrfs=no -if check_include linux/btrfs.h ; then - btrfs=yes -fi - # Search for bswap_32 function byteswap_h=no cat > $TMPC << EOF @@ -6106,9 +6100,6 @@ fi if test "$syncfs" = "yes" ; then echo "CONFIG_SYNCFS=y" >> $config_host_mak fi -if test "$btrfs" = "yes" ; then - echo "CONFIG_BTRFS=y" >> $config_host_mak -fi if test "$inotify" = "yes" ; then echo "CONFIG_INOTIFY=y" >> $config_host_mak fi diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 063130be04..7bf99beb18 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -112,7 +112,7 @@ #include #include #include -#ifdef CONFIG_BTRFS +#ifdef HAVE_BTRFS_H #include #endif #ifdef HAVE_DRM_H diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index cabbfb762d..b934d0b606 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1006,7 +1006,7 @@ struct target_rtc_pll_info { #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) /* btrfs ioctls */ -#ifdef CONFIG_BTRFS +#ifdef HAVE_BTRFS_H #define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1) #define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4) #define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5) diff --git a/meson.build b/meson.build index 04cdea75dd..fba6413056 100644 --- a/meson.build +++ b/meson.build @@ -836,6 +836,7 @@ config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0] config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) +config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h')) config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) -- cgit v1.2.3