<feed xmlns='http://www.w3.org/2005/Atom'>
<title>qemu/include/hw/mem, branch master</title>
<subtitle>QEMU development tree</subtitle>
<id>https://git.zx2c4.com/qemu/atom/include/hw/mem?h=master</id>
<link rel='self' href='https://git.zx2c4.com/qemu/atom/include/hw/mem?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/'/>
<updated>2024-06-19T10:40:49Z</updated>
<entry>
<title>hw/mem/memory-device: Remove legacy_align from memory_device_pre_plug()</title>
<updated>2024-06-19T10:40:49Z</updated>
<author>
<name>Philippe Mathieu-Daudé</name>
<email>philmd@linaro.org</email>
</author>
<published>2024-02-28T09:26:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=0e0bf77d28c573d4b8c8166829ba55664347a499'/>
<id>urn:sha1:0e0bf77d28c573d4b8c8166829ba55664347a499</id>
<content type='text'>
'legacy_align' is always NULL, remove it, simplifying
memory_device_pre_plug().

Signed-off-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Reviewed-by: Thomas Huth &lt;thuth@redhat.com&gt;
Reviewed-by: David Hildenbrand &lt;david@redhat.com&gt;
Reviewed-by: Zhao Liu &lt;zhao1.liu@intel.com&gt;
Reviewed-by: Igor Mammedov &lt;imammedo@redhat.com&gt;
Message-Id: &lt;20240617071118.60464-16-philmd@linaro.org&gt;
</content>
</entry>
<entry>
<title>hw/mem/pc-dimm: Remove legacy_align argument from pc_dimm_pre_plug()</title>
<updated>2024-06-19T10:40:49Z</updated>
<author>
<name>Philippe Mathieu-Daudé</name>
<email>philmd@linaro.org</email>
</author>
<published>2024-02-28T09:26:33Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=d4fdb05b0e640c8ce47ec2dd224e8838ca3f7958'/>
<id>urn:sha1:d4fdb05b0e640c8ce47ec2dd224e8838ca3f7958</id>
<content type='text'>
'legacy_align' is always NULL, remove it.

Signed-off-by: Philippe Mathieu-Daudé &lt;philmd@linaro.org&gt;
Reviewed-by: Thomas Huth &lt;thuth@redhat.com&gt;
Reviewed-by: David Hildenbrand &lt;david@redhat.com&gt;
Reviewed-by: Zhao Liu &lt;zhao1.liu@intel.com&gt;
Reviewed-by: Igor Mammedov &lt;imammedo@redhat.com&gt;
Message-Id: &lt;20240617071118.60464-15-philmd@linaro.org&gt;
</content>
</entry>
<entry>
<title>include: Clean up includes</title>
<updated>2024-01-30T18:20:20Z</updated>
<author>
<name>Peter Maydell</name>
<email>peter.maydell@linaro.org</email>
</author>
<published>2024-01-25T16:34:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=b0b05c9c635bb313d0645c4f16fa56de04b53c6e'/>
<id>urn:sha1:b0b05c9c635bb313d0645c4f16fa56de04b53c6e</id>
<content type='text'>
This commit was created with scripts/clean-includes:
 ./scripts/clean-includes --git include include/*/*.h include/*/*/*.h

All .c should include qemu/osdep.h first.  The script performs three
related cleanups:

* Ensure .c files include qemu/osdep.h first.
* Including it in a .h is redundant, since the .c  already includes
  it.  Drop such inclusions.
* Likewise, including headers qemu/osdep.h includes is redundant.
  Drop these, too.

Signed-off-by: Peter Maydell &lt;peter.maydell@linaro.org&gt;
Reviewed-by: Zhao Liu &lt;zhao1.liu@intel.com&gt;
Signed-off-by: Michael Tokarev &lt;mjt@tls.msk.ru&gt;
</content>
</entry>
<entry>
<title>memory-device: Support empty memory devices</title>
<updated>2023-11-03T19:26:59Z</updated>
<author>
<name>David Hildenbrand</name>
<email>david@redhat.com</email>
</author>
<published>2023-06-22T10:18:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=6c1b28e9e405da8cfb7296b9efa2b85650086784'/>
<id>urn:sha1:6c1b28e9e405da8cfb7296b9efa2b85650086784</id>
<content type='text'>
Let's support empty memory devices -- memory devices that don't have a
memory device region in the current configuration. hv-balloon with an
optional memdev is the primary use case.

Signed-off-by: David Hildenbrand &lt;david@redhat.com&gt;
Signed-off-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
</content>
</entry>
<entry>
<title>memory-device,vhost: Support automatic decision on the number of memslots</title>
<updated>2023-10-12T12:15:22Z</updated>
<author>
<name>David Hildenbrand</name>
<email>david@redhat.com</email>
</author>
<published>2023-09-26T18:57:32Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=a2335113aeda1cddad3dc4a76f2ace47a00d7ac9'/>
<id>urn:sha1:a2335113aeda1cddad3dc4a76f2ace47a00d7ac9</id>
<content type='text'>
We want to support memory devices that can automatically decide how many
memslots they will use. In the worst case, they have to use a single
memslot.

The target use cases are virtio-mem and the hyper-v balloon.

Let's calculate a reasonable limit such a memory device may use, and
instruct the device to make a decision based on that limit. Use a simple
heuristic that considers:
* A memslot soft-limit for all memory devices of 256; also, to not
  consume too many memslots -- which could harm performance.
* Actually still free and unreserved memslots
* The percentage of the remaining device memory region that memory device
  will occupy.

Further, while we properly check before plugging a memory device whether
there still is are free memslots, we have other memslot consumers (such as
boot memory, PCI BARs) that don't perform any checks and might dynamically
consume memslots without any prior reservation. So we might succeed in
plugging a memory device, but once we dynamically map a PCI BAR we would
be in trouble. Doing accounting / reservation / checks for all such
users is problematic (e.g., sometimes we might temporarily split boot
memory into two memslots, triggered by the BIOS).

We use the historic magic memslot number of 509 as orientation to when
supporting 256 memory devices -&gt; memslots (leaving 253 for boot memory and
other devices) has been proven to work reliable. We'll fallback to
suggesting a single memslot if we don't have at least 509 total memslots.

Plugging vhost devices with less than 509 memslots available while we
have memory devices plugged that consume multiple memslots due to
automatic decisions can be problematic. Most configurations might just fail
due to "limit &lt; used + reserved", however, it can also happen that these
memory devices would suddenly consume memslots that would actually be
required by other memslot consumers (boot, PCI BARs) later. Note that this
has always been sketchy with vhost devices that support only a small number
of memslots; but we don't want to make it any worse.So let's keep it simple
and simply reject plugging such vhost devices in such a configuration.

Eventually, all vhost devices that want to be fully compatible with such
memory devices should support a decent number of memslots (&gt;= 509).

Message-ID: &lt;20230926185738.277351-13-david@redhat.com&gt;
Reviewed-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: David Hildenbrand &lt;david@redhat.com&gt;
</content>
</entry>
<entry>
<title>memory-device,vhost: Support memory devices that dynamically consume memslots</title>
<updated>2023-10-12T12:15:22Z</updated>
<author>
<name>David Hildenbrand</name>
<email>david@redhat.com</email>
</author>
<published>2023-09-26T18:57:29Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=766aa0a654d887ad8fed2f116c84a89e20102c14'/>
<id>urn:sha1:766aa0a654d887ad8fed2f116c84a89e20102c14</id>
<content type='text'>
We want to support memory devices that have a dynamically managed memory
region container as device memory region. This device memory region maps
multiple RAM memory subregions (e.g., aliases to the same RAM memory
region), whereby these subregions can be (un)mapped on demand.

Each RAM subregion will consume a memslot in KVM and vhost, resulting in
such a new device consuming memslots dynamically, and initially usually
0. We already track the number of used vs. required memslots for all
memslots. From that, we can derive the number of reserved memslots that
must not be used otherwise.

The target use case is virtio-mem and the hyper-v balloon, which will
dynamically map aliases to RAM memory region into their device memory
region container.

Properly document what's supported and what's not and extend the vhost
memslot check accordingly.

Message-ID: &lt;20230926185738.277351-10-david@redhat.com&gt;
Reviewed-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: David Hildenbrand &lt;david@redhat.com&gt;
</content>
</entry>
<entry>
<title>memory-device: Support memory devices with multiple memslots</title>
<updated>2023-10-12T12:15:22Z</updated>
<author>
<name>David Hildenbrand</name>
<email>david@redhat.com</email>
</author>
<published>2023-09-26T18:57:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=7975feece9053b73a2b7b015840f85e9f6ad25db'/>
<id>urn:sha1:7975feece9053b73a2b7b015840f85e9f6ad25db</id>
<content type='text'>
We want to support memory devices that have a memory region container as
device memory region that maps multiple RAM memory regions. Let's start
by supporting memory devices that statically map multiple RAM memory
regions and, thereby, consume multiple memslots.

We already have one device that uses a container as device memory region:
NVDIMMs. However, a NVDIMM always ends up consuming exactly one memslot.

Let's add support for that by asking the memory device via a new
callback how many memslots it requires.

Message-ID: &lt;20230926185738.277351-7-david@redhat.com&gt;
Reviewed-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: David Hildenbrand &lt;david@redhat.com&gt;
</content>
</entry>
<entry>
<title>nvdimm: Reject writing label data to ROM instead of crashing QEMU</title>
<updated>2023-09-19T08:23:21Z</updated>
<author>
<name>David Hildenbrand</name>
<email>david@redhat.com</email>
</author>
<published>2023-09-06T12:04:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=3a1258399bdf4d4412cbfde36d0d94965eec87b6'/>
<id>urn:sha1:3a1258399bdf4d4412cbfde36d0d94965eec87b6</id>
<content type='text'>
Currently, when using a true R/O NVDIMM (ROM memory backend) with a label
area, the VM can easily crash QEMU by trying to write to the label area,
because the ROM memory is mmap'ed without PROT_WRITE.

    [root@vm-0 ~]# ndctl disable-region region0
    disabled 1 region
    [root@vm-0 ~]# ndctl zero-labels nmem0
    -&gt; QEMU segfaults

Let's remember whether we have a ROM memory backend and properly
reject the write request:

    [root@vm-0 ~]# ndctl disable-region region0
    disabled 1 region
    [root@vm-0 ~]# ndctl zero-labels nmem0
    zeroed 0 nmem

In comparison, on a system with a R/W NVDIMM:

    [root@vm-0 ~]# ndctl disable-region region0
    disabled 1 region
    [root@vm-0 ~]# ndctl zero-labels nmem0
    zeroed 1 nmem

For ACPI, just return "unsupported", like if no label exists. For spapr,
return "H_P2", similar to when no label area exists.

Could we rely on the "unarmed" property? Maybe, but it looks cleaner to
only disallow what certainly cannot work.

After all "unarmed=on" primarily means: cannot accept persistent writes. In
theory, there might be setups where devices with "unarmed=on" set could
be used to host non-persistent data (temporary files, system RAM, ...); for
example, in Linux, admins can overwrite the "readonly" setting and still
write to the device -- which will work as long as we're not using ROM.
Allowing writing label data in such configurations can make sense.

Message-ID: &lt;20230906120503.359863-2-david@redhat.com&gt;
Fixes: dbd730e85987 ("nvdimm: check -object memory-backend-file, readonly=on option")
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: David Hildenbrand &lt;david@redhat.com&gt;
</content>
</entry>
<entry>
<title>acpi/nvdimm: Define trace events for NVDIMM and substitute nvdimm_debug()</title>
<updated>2022-07-26T14:37:46Z</updated>
<author>
<name>Robert Hoo</name>
<email>robert.hu@linux.intel.com</email>
</author>
<published>2022-07-04T08:58:52Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=e4bcec0c3c8527a3f2be2791fa6a89387b9116c1'/>
<id>urn:sha1:e4bcec0c3c8527a3f2be2791fa6a89387b9116c1</id>
<content type='text'>
Signed-off-by: Robert Hoo &lt;robert.hu@linux.intel.com&gt;
Reviewed-by: Jingqi Liu &lt;jingqi.liu@intel.com&gt;
Message-Id: &lt;20220704085852.330005-1-robert.hu@linux.intel.com&gt;
Reviewed-by: Igor Mammedov &lt;imammedo@redhat.com&gt;
Reviewed-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>nvdimm: Add realize, unrealize callbacks to NVDIMMDevice class</title>
<updated>2022-02-18T07:34:13Z</updated>
<author>
<name>Shivaprasad G Bhat</name>
<email>sbhat@linux.ibm.com</email>
</author>
<published>2022-02-18T07:34:13Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=3e35960bf130f759c1b6d72f6a8c08039c08ec16'/>
<id>urn:sha1:3e35960bf130f759c1b6d72f6a8c08039c08ec16</id>
<content type='text'>
A new subclass inheriting NVDIMMDevice is going to be introduced in
subsequent patches. The new subclass uses the realize and unrealize
callbacks. Add them on NVDIMMClass to appropriately call them as part
of plug-unplug.

Signed-off-by: Shivaprasad G Bhat &lt;sbhat@linux.ibm.com&gt;
Acked-by: Daniel Henrique Barboza &lt;danielhb413@gmail.com&gt;
Message-Id: &lt;164396253158.109112.1926755104259023743.stgit@ltczzess4.aus.stglabs.ibm.com&gt;
Signed-off-by: Cédric Le Goater &lt;clg@kaod.org&gt;
</content>
</entry>
</feed>
