Re: [RFC PATCH 02/23] kvm: Switch KVM_CAP_READONLY_MEM to a per-VM ioctl()

2021-02-15 Thread Philippe Mathieu-Daudé
Hi Isaku, On 2/16/21 3:12 AM, Isaku Yamahata wrote: > Switch to making a VM ioctl() call for KVM_CAP_READONLY_MEM, which may > be conditional on VM type in recent versions of KVM, e.g. when TDX is > supported. > > Signed-off-by: Isaku Yamahata > --- > accel/kvm/kvm-all.c | 2 +- > 1 file

Re: [RFC PATCH 01/23] target/i386: Expose x86_cpu_get_supported_feature_word() for TDX

2021-02-15 Thread Philippe Mathieu-Daudé
On 2/16/21 3:12 AM, Isaku Yamahata wrote: > From: Sean Christopherson > > Expose x86_cpu_get_supported_feature_word() outside of cpu.c so that it > can be used by TDX to setup the VM-wide CPUID configuration. > > Signed-off-by: Sean Christopherson > --- > target/i386/cpu.c | 4 ++-- >

Re: [PATCH] virtio-pci: add check for vdev in virtio_pci_isr_read

2021-02-15 Thread Philippe Mathieu-Daudé
Hi Yuri, On 2/16/21 6:29 AM, Yuri Benditovich wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=1743098 Maybe add backtrace in patch description? (gdb) bt #0 0xc5bbdf0d in virtio_pci_notify_write (opaque=0x55b6c6dff170, addr=0, val=<...>, size=<...>) at hw/virtio/virtio-pci.c:1360 #1

Re: [PATCH v2 04/42] esp: add vmstate_esp version to embedded ESPState

2021-02-15 Thread Philippe Mathieu-Daudé
On 2/9/21 8:29 PM, Mark Cave-Ayland wrote: > The QOM object representing ESPState is currently embedded within both the > SYSBUS_ESP and PCI_ESP devices with migration state handled by embedding > vmstate_esp within each device using VMSTATE_STRUCT. > > Since the vmstate_esp fields are embedded

Re: [PATCH v2 08/42] esp: determine transfer direction directly from SCSI phase

2021-02-15 Thread Philippe Mathieu-Daudé
On 2/9/21 8:29 PM, Mark Cave-Ayland wrote: > The transfer direction is currently determined by checking the sign of ti_size > but as this series progresses ti_size can be zero at the end of the transfer. > > Use the SCSI phase to determine the transfer direction as used in other SCSI > controller

Re: [PATCH v2 11/42] esp: apply transfer length adjustment when STC is zero at TC load time

2021-02-15 Thread Philippe Mathieu-Daudé
On 2/9/21 8:29 PM, Mark Cave-Ayland wrote: > Perform the length adjustment whereby a value of 0 in the STC represents > a transfer length of 0x1 at the point where the TC is loaded at the 0x1 -> 64 KiB? > start of a DMA command rather than just when a TI (Transfer Information) > command

Re: [PATCH v2 20/42] esp: remove the buf and buflen parameters from get_cmd()

2021-02-15 Thread Philippe Mathieu-Daudé
On 2/9/21 8:29 PM, Mark Cave-Ayland wrote: > Now that all SCSI commands are accumulated in cmdbuf, remove the buf and > buflen > parameters from get_cmd() since these always reference cmdbuf and > ESP_CMDBUF_SZ > respectively. > > Signed-off-by: Mark Cave-Ayland > --- > hw/scsi/esp.c | 11

Re: [PATCH v2 30/42] esp: add 4 byte PDMA read and write transfers

2021-02-15 Thread Philippe Mathieu-Daudé
Hi Mark, On 2/15/21 11:35 PM, Mark Cave-Ayland wrote: > On 12/02/2021 18:56, Philippe Mathieu-Daudé wrote: > >> On 2/9/21 8:30 PM, Mark Cave-Ayland wrote: >>> The MacOS toolbox ROM performs 4 byte reads/writes when transferring >>> data to >>> and from the target. Since the SCSI bus is 16-bits

Re: [PATCH] scripts/checkpatch: Improve the check for authors mangled by the mailing list

2021-02-15 Thread Philippe Mathieu-Daudé
On 2/16/21 8:15 AM, Thomas Huth wrote: > There were recently some patches on the list which had their "From:" > line mangled like this: > > From: qemu_oss--- via > > Since our test in the checkpatch.pl script did not trigger here, the > patches finally also ended up in a pull request, with the

[PATCH] scripts/checkpatch: Improve the check for authors mangled by the mailing list

2021-02-15 Thread Thomas Huth
There were recently some patches on the list which had their "From:" line mangled like this: From: qemu_oss--- via Since our test in the checkpatch.pl script did not trigger here, the patches finally also ended up in a pull request, with the wrong author set. So let's improve the regular

Re: [RFC PATCH 28/42] target/mips/tx79: Move RDHWR usermode kludge to trans_SQ()

2021-02-15 Thread Fredrik Noring
On Mon, Feb 15, 2021 at 01:01:52PM -0800, Richard Henderson wrote: > On 2/14/21 9:58 AM, Philippe Mathieu-Daudé wrote: > > +/* > > + * The TX79-specific instruction Store Quadword > > + * > > + * ++---+---++ > > + * | 01 | base |

Re: [PATCH] gitlab-ci: Only push Docker 'latest' image when building default branch

2021-02-15 Thread Philippe Mathieu-Daudé
On 2/16/21 7:55 AM, Thomas Huth wrote: > On 15/02/2021 20.28, Philippe Mathieu-Daudé wrote: >> While we are interested in building docker images in different >> branches, it only makes sense to push 'latest' to the registry >> when this is the project default branch (usually 'master'). >> >> Else

Re: [PATCH] gitlab-ci: Only push Docker 'latest' image when building default branch

2021-02-15 Thread Thomas Huth
On 15/02/2021 20.28, Philippe Mathieu-Daudé wrote: While we are interested in building docker images in different branches, it only makes sense to push 'latest' to the registry when this is the project default branch (usually 'master'). Else when pushing different branches concurrently we might

[PATCH] virtio-pci: add check for vdev in virtio_pci_isr_read

2021-02-15 Thread Yuri Benditovich
https://bugzilla.redhat.com/show_bug.cgi?id=1743098 There is missing check for vdev in this procedure. QEMU crash happens in it in hot unplug flow. Signed-off-by: Yuri Benditovich --- hw/virtio/virtio-pci.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git

Re: [PATCH v7 03/14] block: check return value of bdrv_open_child and drop error propagation

2021-02-15 Thread Vladimir Sementsov-Ogievskiy
15.02.2021 23:04, Eric Blake wrote: On 2/15/21 3:22 AM, Kevin Wolf wrote: With this patch applied, 'check unit-test' fails with: Running test test-replication Unexpected error in bdrv_open_driver() at ../block.c:1481: Could not open '/tmp/p_local_disk.z1Ugyc': Invalid argument ERROR

[PULL 7/9] Acceptance Tests: introduce method for requiring an accelerator

2021-02-15 Thread Cleber Rosa
Some tests explicitly require a QEMU accelerator to be available. Given that this depends on some runtime aspects not known before the test is started, such as the currently set QEMU binary, it's left to be checked also at runtime. Signed-off-by: Cleber Rosa Message-Id:

[PULL 9/9] Acceptance Tests: set up existing ssh keys by default

2021-02-15 Thread Cleber Rosa
It's questionable whether it's necessary to create one brand new pair for each test. It's not questionable that it takes less time and resources to just use the keys available at "tests/keys" that exist for that exact reason. If a location for the public key is not given explicitly, the

[PULL 5/9] maint: Tell git that *.py files should use python diff hunks

2021-02-15 Thread Cleber Rosa
From: Eric Blake Git's default hunk pattern recognizer favors the C language, but it also includes several built-in diff styles that give saner results in other languages. In particular, telling git to treat all .py files as python changes the beginning of diff hunks as follows: | ---

[PULL 8/9] Acceptance Tests: fix population of public key in cloudinit image

2021-02-15 Thread Cleber Rosa
Currently the path of the ssh public key is being set, but its content is obviously what's needed. Signed-off-by: Cleber Rosa Message-Id: <20210203172357.1422425-18-cr...@redhat.com> Reviewed-by: Marc-André Lureau Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo

[PULL 6/9] Acceptance Tests: introduce LinuxTest base class

2021-02-15 Thread Cleber Rosa
This is basically the infrastructure around "boot_linux.py" tests, but now made into a base class for general use. Signed-off-by: Cleber Rosa Message-Id: <20210203172357.1422425-15-cr...@redhat.com> Reviewed-by: Wainer dos Santos Moschetta Reviewed-by: Willian Rampazzo Signed-off-by: Cleber

[PULL 1/9] Acceptance Tests: bump Avocado version requirement to 85.0

2021-02-15 Thread Cleber Rosa
This version (and 84.0) contain improvements that address specific QEMU use cases, including: * Being able to download and use Fedora 31 images and thus re-activate the "boot_linux.py" tests * Being able to register local assets via "avocado assets register" and use them in tests

[PULL 4/9] tests/acceptance/virtio-gpu.py: preserve virtio-user-gpu log

2021-02-15 Thread Cleber Rosa
Preserve log at location already prepared for keeping the test's log files. While at it, log info about its location (in the main test log file), instead of printing it out. Reference: https://avocado-framework.readthedocs.io/en/85.0/api/test/avocado.html#avocado.Test.logdir Signed-off-by:

[PULL 3/9] Python: close the log file kept by QEMUMachine before reading it

2021-02-15 Thread Cleber Rosa
Closing a file that is open for writing, and then reading from it sounds like a better idea than the opposite, given that the content will be flushed. Reference: https://docs.python.org/3/library/io.html#io.IOBase.close Signed-off-by: Cleber Rosa Message-Id:

[PULL 2/9] virtiofs_submounts.py test: Note on vmlinuz param

2021-02-15 Thread Cleber Rosa
From: Max Reitz >From the cancel message, it is not entirely clear why this parameter is mandatory now, or that it will be optional in the future. Add such a more detailed explanation as a comment in the test source file. Suggested-by: Alex Bennée Signed-off-by: Max Reitz Message-Id:

[PULL 0/9] Acceptance Tests and Python libs patches for 2021-02-15

2021-02-15 Thread Cleber Rosa
The following changes since commit 8ba4bca570ace1e60614a0808631a517cf5df67a: Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging= (2021-02-15 17:13:57 +) are available in the Git repository at: https://gitlab.com/cleber.gnu/qemu.git/

[PATCH v2 6/6] hw/sd: sdhci: Reset the data pointer of s->fifo_buffer[] when a different block size is programmed

2021-02-15 Thread Bin Meng
If the block size is programmed to a different value from the previous one, reset the data pointer of s->fifo_buffer[] so that s->fifo_buffer[] can be filled in using the new block size in the next transfer. With this fix, the following reproducer: outl 0xcf8 0x80001010 outl 0xcfc 0xe000

[PATCH v2 5/6] hw/sd: sdhci: Limit block size only when SDHC_BLKSIZE register is writable

2021-02-15 Thread Bin Meng
The codes to limit the maximum block size is only necessary when SDHC_BLKSIZE register is writable. Signed-off-by: Bin Meng --- Changes in v2: - new patch: sdhci: Limit block size only when SDHC_BLKSIZE register is writable hw/sd/sdhci.c | 14 +++--- 1 file changed, 7 insertions(+),

[PATCH v2 3/6] hw/sd: sdhci: Correctly set the controller status for ADMA

2021-02-15 Thread Bin Meng
When an ADMA transfer is started, the codes forget to set the controller status to indicate a transfer is in progress. With this fix, the following 2 reproducers: https://paste.debian.net/plain/1185136 https://paste.debian.net/plain/1185141 cannot be reproduced with the following QEMU command

[PATCH v2 4/6] hw/sd: sdhci: Simplify updating s->prnsts in sdhci_sdma_transfer_multi_blocks()

2021-02-15 Thread Bin Meng
s->prnsts is updated in both branches of the if () else () statement. Move the common bits outside so that it is cleaner. Signed-off-by: Bin Meng --- (no changes since v1) hw/sd/sdhci.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c

[PATCH v2 2/6] hw/sd: sdhci: Don't write to SDHC_SYSAD register when transfer is in progress

2021-02-15 Thread Bin Meng
Per "SD Host Controller Standard Specification Version 7.00" chapter 2.2.1 SDMA System Address Register: This register can be accessed only if no transaction is executing (i.e., after a transaction has stopped). With this fix, the following reproducer: https://paste.debian.net/plain/1185137

[PATCH v2 1/6] hw/sd: sdhci: Don't transfer any data when command time out

2021-02-15 Thread Bin Meng
At the end of sdhci_send_command(), it starts a data transfer if the command register indicates data is associated. But the data transfer should only be initiated when the command execution has succeeded. With this fix, the following reproducer: outl 0xcf8 0x80001810 outl 0xcfc 0xe1068000 outl

[PATCH v2 0/6] hw/sd: sdhci: Fixes to CVE-2020-17380, CVE-2020-25085, CVE-2021-3409

2021-02-15 Thread Bin Meng
This series includes several fixes to CVE-2020-17380, CVE-2020-25085 and CVE-2021-3409 that are heap-based buffer overflow issues existing in the sdhci model. These CVEs are pretty much similar, and were filed using different reproducers. With this series, current known reproducers I have cannot

Re: [PATCH 00/22] Acceptance Test: introduce base class for Linux based tests

2021-02-15 Thread Cleber Rosa
On Mon, Feb 15, 2021 at 06:03:33PM +0100, Philippe Mathieu-Daudé wrote: > On 2/15/21 4:49 PM, Wainer dos Santos Moschetta wrote: > > Hi, > > > > On 2/8/21 8:35 AM, Philippe Mathieu-Daudé wrote: > >> On 2/3/21 6:23 PM, Cleber Rosa wrote: > >>> This introduces a base class for tests that need to

Re: [PATCH 18/22] Acceptance Tests: set up existing ssh keys by default

2021-02-15 Thread Cleber Rosa
On Thu, Feb 11, 2021 at 02:15:32PM +0400, Marc-André Lureau wrote: > Hi > > On Wed, Feb 3, 2021 at 10:07 PM Cleber Rosa wrote: > > > > It's questionable wether it's necessary to create one brand new pair > > whether > Yep, thanks! > > for each test. It's not questionable that it takes less

Re: [PATCH 14/22] Acceptance Tests: introduce LinuxTest base class

2021-02-15 Thread Cleber Rosa
On Mon, Feb 15, 2021 at 04:06:45PM -0300, Willian Rampazzo wrote: > On Wed, Feb 3, 2021 at 2:24 PM Cleber Rosa wrote: > > > > This is basically the infrastructure around "boot_linux.py" tests, but > > now made into a base class for general use. > > > > Signed-off-by: Cleber Rosa > > --- > >

Re: [PATCH] maint: Tell git that *.py files should use python diff hunks

2021-02-15 Thread Cleber Rosa
On Mon, Feb 15, 2021 at 04:25:24PM -0600, Eric Blake wrote: > Git's default hunk pattern recognizer favors the C language, but it > also includes several built-in diff styles that give saner results in > other languages. In particular, telling git to treat all .py files as > python changes the

[PATCH v6 19/19] qapi/introspect.py: add SchemaMetaType enum

2021-02-15 Thread John Snow
Follows the qapi/introspect.py definition of the same; this adds a more precise typing to _gen_tree's mtype parameter. NB: print(SchemaMetaType.BUILTIN) would produce the string "SchemaMetaType.BUILTIN", but when using format strings (.format or f-strings), it relies on the __format__ method

Re: [PATCH 1/6] Python: close the log file kept by QEMUMachine before reading it

2021-02-15 Thread Cleber Rosa
On Mon, Feb 15, 2021 at 03:30:16PM -0300, Wainer dos Santos Moschetta wrote: > Hi, > > On 2/11/21 7:01 PM, Cleber Rosa wrote: > > Closing a file that is open for writing, and then reading from it > > sounds like a better idea than the opposite, given that the content > > will be flushed. > > > >

[PATCH v6 16/19] qapi/introspect.py: Update copyright and authors list

2021-02-15 Thread John Snow
To reflect the work that went into strictly typing introspect.py, punish myself by claiming credit. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index

[PATCH v6 10/19] qapi/introspect.py: create a typed 'Annotated' data strutcure

2021-02-15 Thread John Snow
Presently, we use a tuple to attach a dict containing annotations (comments and compile-time conditionals) to a tree node. This is undesirable because dicts are difficult to strongly type; promoting it to a real class allows us to name the values and types of the annotations we are expecting. In

[PATCH v6 13/19] qapi/introspect.py: remove _gen_variants helper

2021-02-15 Thread John Snow
It is easier to give a name to all of the dictly-typed objects we pass around in introspect.py by removing this helper, as it does not return an object that has any knowable type by itself. Inline it into its only caller instead. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 9

[PATCH v6 14/19] qapi/introspect.py: add type hint annotations

2021-02-15 Thread John Snow
NB: The type aliases (SchemaInfo et al) declare intent for some of the "dictly-typed" objects we pass around in introspect.py. They do not enforce the shape of those objects, and cannot, until Python 3.7 or later. (And even then, it may not be "worth it".) Signed-off-by: John Snow ---

[PATCH v6 11/19] qapi/introspect.py: improve _tree_to_qlit error message

2021-02-15 Thread John Snow
Trivial; make the error message just a pinch more explicit in case we trip this by accident in the future. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index

[PATCH v6 03/19] qapi/introspect.py: use _make_tree for features nodes

2021-02-15 Thread John Snow
At present, we open-code this in _make_tree itself; but if the structure of the tree changes, this is brittle. Use an explicit recursive call to _make_tree when appropriate to help keep the interior node typing consistent. A consequence of doing this is that the 'ifcond' key of the features dict

[PATCH v6 18/19] qapi/introspect.py: set _gen_tree's default ifcond argument to ()

2021-02-15 Thread John Snow
We don't need to create an empty, mutable list to pass to _gen_tree; since it is now typed as a Sequence, we can use the empty tuple as a default and omit the argument. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v6 09/19] qapi/introspect.py: Introduce preliminary tree typing

2021-02-15 Thread John Snow
The types will be used in forthcoming patches to add typing. These types describe the layout and structure of the objects passed to _tree_to_qlit, but lack the power to describe annotations until the next commit. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 31

Re: [PATCH 1/6] Python: close the log file kept by QEMUMachine before reading it

2021-02-15 Thread Cleber Rosa
On Mon, Feb 15, 2021 at 05:04:24PM -0500, John Snow wrote: > On 2/11/21 5:01 PM, Cleber Rosa wrote: > > Closing a file that is open for writing, and then reading from it > > sounds like a better idea than the opposite, given that the content > > will be flushed. > > > > Reference:

[PATCH v6 02/19] qapi/introspect.py: assert schema is not None

2021-02-15 Thread John Snow
The introspect visitor is stateful, but expects that it will have a schema to refer to. Add assertions that state this. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 5 + 1 file changed, 5 insertions(+) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index

[PATCH v6 07/19] qapi/introspect.py: replace 'extra' dict with 'comment' argument

2021-02-15 Thread John Snow
This is only used to pass in a dictionary with a comment already set, so skip the runaround and just accept the (optional) comment. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git

[PATCH v6 08/19] qapi/introspect.py: Always define all 'extra' dict keys

2021-02-15 Thread John Snow
This mimics how a typed object works, where 'if' and 'comment' are always set, regardless of if they have a value set or not. It is safe to do this because of the way that _tree_to_qlit processes these values (using dict.get with a default of None), resulting in no change of output from

[PATCH v6 17/19] qapi/introspect.py: Type _gen_tree variants as Sequence[str]

2021-02-15 Thread John Snow
Optional[List] is clunky; an empty sequence can more elegantly convey "no variants". By downgrading "List" to "Sequence", we can also accept tuples; this is useful for the empty tuple specifically, which we may use as a default parameter because it is immutable. Signed-off-by: John Snow ---

[RFC PATCH 21/23] i386/tdx: Use KVM_TDX_INIT_VCPU to pass HOB to TDVF

2021-02-15 Thread Isaku Yamahata
Specify the initial value for RCX/R8 to be the address of the HOB. Don't propagate the value to Qemu's cache of the registers so as to avoid implying that the register state is valid, e.g. Qemu doesn't model TDX-SEAM behavior for initializing other GPRs. Signed-off-by: Isaku Yamahata ---

[PATCH v6 15/19] qapi/introspect.py: Add docstrings to _gen_tree and _tree_to_qlit

2021-02-15 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/introspect.py | 18 ++ 1 file changed, 18 insertions(+) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index 45284af1330..5d4f5e23f7e 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -99,6

[PATCH v6 05/19] qapi/introspect.py: guard against ifcond/comment misuse

2021-02-15 Thread John Snow
_tree_to_qlit is called recursively on dict values (isolated from their keys); at such a point in generating output it is too late to apply an ifcond. Similarly, comments do not necessarily have a "tidy" place they can be printed in such a circumstance. Forbid this usage by renaming

[RFC PATCH 20/23] i386/tdx: Add TDVF memory via INIT_MEM_REGION

2021-02-15 Thread Isaku Yamahata
Add, and optionally measure, TDVF memory via KVM_TDX_INIT_MEM_REGION as part of finalizing the TD. Signed-off-by: Isaku Yamahata Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson --- target/i386/kvm/tdx.c | 19 --- 1 file changed, 16 insertions(+), 3

[PATCH v6 12/19] qapi/introspect.py: improve readability of _tree_to_qlit

2021-02-15 Thread John Snow
Subjective, but I find getting rid of the comprehensions helps. Also, divide the sections into scalar and non-scalar sections, and remove old-style string formatting. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 33 ++--- 1 file changed, 18

[RFC PATCH 16/23] hw/i386: Add definitions from UEFI spec for volumes, resources, etc...

2021-02-15 Thread Isaku Yamahata
Add definitions for literals, enums, structs, GUIDs, etc... that will be used by TDX to build the UEFI Hand-Off Block (HOB) that is passed to the Trusted Domain Virtual Firmware (TDVF). All values come from the UEFI specification. note: EFI_RESOURCE_ATTRIBUTE_{ENCRYPTED, UNACCEPTED}, will be

[PATCH v6 01/19] qapi: Replace List[str] with Sequence[str] for ifcond

2021-02-15 Thread John Snow
It does happen to be a list (as of now), but we can describe it in more general terms with no loss in accuracy to allow tuples and other constructs. In the future, we can write "ifcond: Sequence[str] = ()" as a default parameter, which we could not do with a Mutable type like a List.

[PATCH v6 06/19] qapi/introspect.py: Unify return type of _make_tree()

2021-02-15 Thread John Snow
Returning two different types conditionally can be complicated to type. Return one type for consistency. Signed-off-by: John Snow --- scripts/qapi/introspect.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index

[PATCH v6 04/19] qapi/introspect.py: add _gen_features helper

2021-02-15 Thread John Snow
_make_tree might receive a dict (a SchemaInfo object) or some other type (usually, a string) for its obj parameter. Adding features information should arguably be performed by the caller at such a time when we know the type of the object and don't have to re-interrogate it. Signed-off-by: John

[PATCH v6 00/19] qapi: static typing conversion, pt2

2021-02-15 Thread John Snow
Hi, this series adds static type hints to the QAPI module. This is part two, and covers introspect.py. Part 2: https://gitlab.com/jsnow/qemu/-/tree/python-qapi-cleanup-pt2 Everything: https://gitlab.com/jsnow/qemu/-/tree/python-qapi-cleanup-pt6 - Requires Python 3.6+ - Requires mypy 0.770 or

[RFC PATCH 15/23] i386/tdx: Add hook to require generic device loader

2021-02-15 Thread Isaku Yamahata
From: Sean Christopherson Add a hook for TDX to denote that the TD Virtual Firmware must be provided via the "generic" device loader. Error out if pflash is used in conjuction with TDX. Suggested-by: Isaku Yamahata Signed-off-by: Sean Christopherson --- hw/i386/pc_sysfw.c | 6

Re: [PATCH 1/3] target/arm: Add support for FEAT_SSBS, Speculative Store Bypass Safe

2021-02-15 Thread Rebecca Cran
On 2/15/21 5:19 PM, Richard Henderson wrote: On 2/15/21 1:58 PM, Rebecca Cran wrote: @@ -960,6 +960,12 @@ static void cpsr_write_from_spsr_elx(CPUARMState *env, val |= CPSR_DIT; } +/* Move SSBS to the correct location for CPSR */ +if (val & PSTATE_SSBS) { +

[RFC PATCH 23/23] target/i386: Add machine option to disable PIC/8259

2021-02-15 Thread Isaku Yamahata
From: Sean Christopherson Add a machine option to disable the legacy PIC (8259), which cannot be supported for TDX guests as TDX-SEAM doesn't allow directly interrupt injection. Using posted interrupts for the PIC is not a viable option as the guest BIOS/kernel will not do EOI for PIC IRQs,

[RFC PATCH 18/23] i386/tdx: Parse tdvf metadata and store the result into TdxGuest

2021-02-15 Thread Isaku Yamahata
Add support for loading TDX's Trusted Domain Virtual Firmware (TDVF) via the generic loader. Prioritize the TDVF above plain hex to avoid false positives with hex (TDVF has explicit metadata to confirm it's a TDVF). Enumerate TempMem as added, private memory, i.e. E820_RESERVED, otherwise TDVF

[RFC PATCH 22/23] i386/tdx: Force x2apic mode and routing for TDs

2021-02-15 Thread Isaku Yamahata
From: Sean Christopherson TDX requires x2apic and "resets" vCPUs to have x2apic enabled. Model this in QEMU and unconditionally enable x2apic interrupt routing. This fixes issues where interrupts from IRQFD would not get forwarded to the guest due to KVM silently dropping the invalid routing

[RFC PATCH 13/23] i386/tdx: Frame in tdx_get_supported_cpuid with KVM_TDX_CAPABILITIES

2021-02-15 Thread Isaku Yamahata
From: Sean Christopherson Add support for grabbing KVM_TDX_CAPABILITIES and use the new kvm_get_supported_cpuid() hook to adjust the supported XCR0 bits. Add TODOs for the remaining work. Signed-off-by: Sean Christopherson --- target/i386/kvm/kvm.c | 2 ++ target/i386/kvm/tdx.c | 84

[RFC PATCH 14/23] i386/tdx: Frame in the call for KVM_TDX_INIT_VCPU

2021-02-15 Thread Isaku Yamahata
Signed-off-by: Sean Christopherson --- include/sysemu/tdx.h | 1 + target/i386/kvm/kvm.c | 8 target/i386/kvm/tdx-stub.c | 4 target/i386/kvm/tdx.c | 20 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/include/sysemu/tdx.h

[RFC PATCH 11/23] hw/i386: Initialize TDX via KVM ioctl() when kvm_type is TDX

2021-02-15 Thread Isaku Yamahata
From: Xiaoyao Li Introduce tdx_ioctl() to invoke TDX specific sub-ioctls of KVM_MEMORY_ENCRYPT_OP. Use tdx_ioctl() to invoke KVM_TDX_INIT, by way of tdx_init(), during kvm_arch_init(). KVM_TDX_INIT configures global TD state, e.g. the canonical CPUID config, and must be executed prior to

[RFC PATCH 01/23] target/i386: Expose x86_cpu_get_supported_feature_word() for TDX

2021-02-15 Thread Isaku Yamahata
From: Sean Christopherson Expose x86_cpu_get_supported_feature_word() outside of cpu.c so that it can be used by TDX to setup the VM-wide CPUID configuration. Signed-off-by: Sean Christopherson --- target/i386/cpu.c | 4 ++-- target/i386/cpu.h | 3 +++ 2 files changed, 5 insertions(+), 2

[RFC PATCH 19/23] i386/tdx: Create the TD HOB list upon machine init done

2021-02-15 Thread Isaku Yamahata
Build the TD HOB during machine late initialization, i.e. once guest memory is fully defined. Note, the attribute absolutely for MMIO HOB entries must include UNCACHEABLE, else TDVF will effectively consider it a bad HOB entry and ignore it. Signed-off-by: Isaku Yamahata Co-developed-by: Sean

[RFC PATCH 10/23] linux-headers: Update headers to pull in TDX API changes

2021-02-15 Thread Isaku Yamahata
From: Xiaoyao Li Pull in recent TDX updates, which are not backwards compatible. Signed-off-by: Xiaoyao Li Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson --- linux-headers/asm-x86/kvm.h | 55 + linux-headers/linux/kvm.h | 2 ++

[RFC PATCH 04/23] i386/kvm: Move architectural CPUID leaf generation to separarte helper

2021-02-15 Thread Isaku Yamahata
From: Sean Christopherson Move the architectural (for lack of a better term) CPUID leaf generation to a separate helper so that the generation code can be reused by TDX, which needs to generate a canonical VM-scoped configuration. Signed-off-by: Sean Christopherson --- target/i386/kvm/kvm.c

[RFC PATCH 17/23] i386/tdx: Add definitions for TDVF metadata

2021-02-15 Thread Isaku Yamahata
Add constants and structs for the TD Virtual Firmware metadata, which describes how the TDVF must be built to ensure correct functionality and measurement. Signed-off-by: Isaku Yamahata Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson --- include/hw/i386/tdvf.h | 55

[RFC PATCH 09/23] target/i386: kvm: don't synchronize guest tsc for TD guest

2021-02-15 Thread Isaku Yamahata
Make kvm_synchronize_all_tsc() nop for TD-guest. TDX module specification, 9.11.1 TSC Virtualization "Virtual TSC values are consistent among all the TD;s VCPUs at the level suppored by the CPU". There is no need for qemu to synchronize tsc and VMM can't access to guest TSC. Actually

[RFC PATCH 08/23] i386/kvm: Skip KVM_X86_SETUP_MCE for TDX guests

2021-02-15 Thread Isaku Yamahata
Despite advertising MCE support to the guest, TDX-SEAM doesn't support injecting #MCs into the guest. All of the associated setup is thus rejected by KVM. Signed-off-by: Isaku Yamahata --- target/i386/kvm/kvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[RFC PATCH 07/23] i386/kvm: Squash getting/putting guest state for TDX VMs

2021-02-15 Thread Isaku Yamahata
From: Sean Christopherson Ignore get/put state of TDX VMs as accessing/mutating guest state of producation TDs is not supported. Allow kvm_arch_get_registers() to run as normal, except for MSRs, for debug TDs, and silently ignores attempts to read guest state for non-debug TDs. Signed-off-by:

[RFC PATCH 12/23] target/i386/tdx: Finalize the TD's measurement when machine is done

2021-02-15 Thread Isaku Yamahata
From: Xiaoyao Li Invoke KVM_TDX_FINALIZEMR to finalize the TD's measurement and make the TD vCPUs runnable once machine initialization is complete. Signed-off-by: Xiaoyao Li --- target/i386/kvm/kvm.c | 7 +++ target/i386/kvm/tdx.c | 20 target/i386/kvm/tdx.h | 3 +++

[RFC PATCH 03/23] KVM: i386: use VM capability check for KVM_CAP_X86_SMM

2021-02-15 Thread Isaku Yamahata
From: Isaku Yamahata KVM_CAP_X86_SMM is VM-specific capability for TDX. So use VM ioctl for KVM_CAP_X86_SMM. Signed-off-by: Isaku Yamahata --- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index

[RFC PATCH 02/23] kvm: Switch KVM_CAP_READONLY_MEM to a per-VM ioctl()

2021-02-15 Thread Isaku Yamahata
Switch to making a VM ioctl() call for KVM_CAP_READONLY_MEM, which may be conditional on VM type in recent versions of KVM, e.g. when TDX is supported. Signed-off-by: Isaku Yamahata --- accel/kvm/kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c

[RFC PATCH 06/23] hw/i386: Introduce kvm-type for TDX guest

2021-02-15 Thread Isaku Yamahata
From: Xiaoyao Li Introduce a machine property, kvm-type, to allow the user to create a Trusted Domain eXtensions (TDX) VM, a.k.a. a Trusted Domain (TD), e.g.: # $QEMU \ -machine ...,kvm-type=tdx \ ... Only two types are supported: "legacy" and "tdx", with "legacy" being the

[RFC PATCH 05/23] vl: Introduce machine_init_done_late notifier

2021-02-15 Thread Isaku Yamahata
Introduce a new notifier, machine_init_done_late, that is notified after machine_init_done. This will be used by TDX to generate the HOB for its virtual firmware, which needs to be done after all guest memory has been added, i.e. after machine_init_done notifiers have run. some devices

[RFC PATCH 00/23] [RFC PATCH 00/24] TDX support

2021-02-15 Thread Isaku Yamahata
This patch series is to enable TDX support. This needs corresponding KVM patch for TDX[] and more patches are needed that addresses generic corner cases, e.g. ACPI related stuff, are needed. So This patch series is RFC. More emulated devices and their behavior needs to be adjusted as some

[PATCH] hw/char: disable ibex uart receive if the buffer is full

2021-02-15 Thread Alexander Wagner
Not disabling the UART leads to QEMU overwriting the UART receive buffer with the newest received byte. The rx_level variable is added to allow the use of the existing OpenTitan driver libraries. Signed-off-by: Alexander Wagner --- hw/char/ibex_uart.c | 20 +++-

Re: [PATCH v9 0/6] Rework iotests/check

2021-02-15 Thread John Snow
On 1/26/21 10:15 AM, Vladimir Sementsov-Ogievskiy wrote: OK, thanks for handling it! When will we move to python 3.7? "I don't know, but it seems like a very long time." The nominal EOL for Python 3.6 is this December; see https://www.python.org/dev/peps/pep-0494/ Debian 10 ships 3.7.

Re: [PATCH 0/4] hw/sd: sdhci: Fixes to CVE-2020-17380, CVE-2020-25085, CVE-2021-3409

2021-02-15 Thread Alexander Bulekov
On 210216 0855, Bin Meng wrote: > Hi Alex, > > On Tue, Feb 16, 2021 at 12:48 AM Alexander Bulekov wrote: > > > > Hi Bin, > > Thank you for this. I ran through the OSS-Fuzz tests again, and it found > > one thing: > > Thanks for testing. Are there instructions to run OSS-Fuzz tests myself? Yes

[PATCH v4 03/10] ich9, piix4: add properoty, smm-compat, to keep compatibility of SMM

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata The following patch will introduce incompatible behavior of SMM. Introduce a property to keep the old behavior for compatibility. To enable smm compat, use "-global ICH9-LPC.smm-compat=on" or "-global PIIX4.smm-compat=on" Suggested-by: Igor Mammedov Signed-off-by: Isaku

[PATCH v4 04/10] acpi/core: always set SCI_EN when SMM isn't supported

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata If SMM is not supported, ACPI fixed hardware doesn't support legacy-mode. ACPI-only platform. Where SCI_EN in PM1_CNT register is always set. The bit tells OS legacy mode(SCI_EN cleared) or ACPI mode(SCI_EN set). With the next patch (setting fadt.smi_cmd = 0 when smm isn't

[PATCH v4 10/10] qtest/acpi/bios-tables-test: update acpi tables

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata update golden master acpi tables and empty bios-tables-test-allowed-diff.h. Signed-off-by: Isaku Yamahata --- tests/data/acpi/pc/DSDT.nohpet | Bin 0 -> 4923 bytes tests/data/acpi/pc/FACP.nosmm | Bin 0 -> 116 bytes tests/data/acpi/q35/DSDT

[PATCH v4 06/10] acpi: add test case for smm unsupported -machine smm=off

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata Reviewed-by: Igor Mammedov Signed-off-by: Isaku Yamahata --- tests/qtest/bios-tables-test.c | 76 ++ 1 file changed, 76 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 669202fc95..592c074ec7

[PATCH v4 09/10] acpi: add test case for -no-hpet

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata Reviewed-by: Igor Mammedov Signed-off-by: Isaku Yamahata --- tests/qtest/bios-tables-test.c | 24 1 file changed, 24 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 592c074ec7..3fb7ed0c46 100644

[PATCH v4 02/10] qtest: update tests/qtest/bios-tables-test-allowed-diff.h

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata The following tests will modify acpi tables. prepare qtests to allow acpi table change. add new tables for new tests. - tests/data/acpi/pc/DSDT.nohpet - tests/data/acpi/pc/FACP.nosmm - tests/data/acpi/q35/DSDT.nohpet - tests/data/acpi/q35/FACP.nosmm Acked-by: Igor Mammedov

[PATCH v4 00/10] ACPI related fixes to comform the spec better

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata Miscellaneous bug fixes related to ACPI to play nice with guest BIOSes/OSes by conforming to ACPI spec better. Changes from v3: - rename compat property name to smm-compat and add it to ICH9-LPC and PIIX4_PM - MMCFG memory region to use dword memory region when possible -

[PATCH v4 08/10] i386: acpi: Don't build HPET ACPI entry if HPET is disabled

2021-02-15 Thread isaku . yamahata
From: Sean Christopherson Omit HPET AML if the HPET is disabled, QEMU is not emulating it and the guest may get confused by seeing HPET in the ACPI tables without a "physical" device present. The change of DSDT when -no-hpet is as follows. @@ -141,47 +141,6 @@ DefinitionBlock ("", "DSDT", 1,

[PATCH v4 07/10] hw/i386: declare ACPI mother board resource for MMCONFIG region

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata Declare PNP0C01 device to reserve MMCONFIG region to conform to the spec better and play nice with guest BIOSes/OSes. According to PCI Firmware Specification[0], MMCONFIG region must be reserved by declaring a motherboard resource. It's optional to reserve the region in

[PATCH v4 05/10] acpi: set fadt.smi_cmd to zero when SMM is not supported

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata >From table 5.9 SMI_CMD of ACPI spec > This field is reserved and must be zero on system > that does not support System Management mode. When smm is not enabled, set it to zero to comform to the spec. When -machine smm=off is passed, the change to FACP is as follows. @@

[PATCH v4 01/10] checkpatch: don't emit warning on newly created acpi data files

2021-02-15 Thread isaku . yamahata
From: Isaku Yamahata Newly created acpi data files(tests/data/acpi/) cause false positive warning. If file names are acpi expected file, don't emit warning. Fixes: e625ba2a41 ("checkpatch: fix acpi check with multiple file name") Signed-off-by: Isaku Yamahata --- scripts/checkpatch.pl | 4

Re: [PATCH 0/4] hw/sd: sdhci: Fixes to CVE-2020-17380, CVE-2020-25085, CVE-2021-3409

2021-02-15 Thread Bin Meng
Hi Alex, On Tue, Feb 16, 2021 at 12:48 AM Alexander Bulekov wrote: > > Hi Bin, > Thank you for this. I ran through the OSS-Fuzz tests again, and it found > one thing: Thanks for testing. Are there instructions to run OSS-Fuzz tests myself? > Maybe this is already much better than the current

Re: [PATCH] hw/display/tcx: Drop unnecessary code for handling BGR format outputs

2021-02-15 Thread Richard Henderson
On 2/15/21 2:21 AM, Peter Maydell wrote: > For a long time now the UI layer has guaranteed that the console > surface is always 32 bits per pixel, RGB. The TCX code already > assumes 32bpp, but it still has some checks of is_surface_bgr() > in an attempt to support 32bpp BGR. is_surface_bgr() will

Re: [PATCH 0/9] arm: drop dead code for non-32-bit-RGB surfaces

2021-02-15 Thread Richard Henderson
On 2/15/21 2:32 AM, Peter Maydell wrote: > Peter Maydell (9): > hw/arm/musicpal: Remove dead code for non-32-bit-RGB surfaces > hw/display/tc6393xb: Remove dead code for handling non-32bpp surfaces > hw/display/tc6393xb: Expand out macros in template header > hw/display/tc6393xb: Inline

  1   2   3   4   5   >