[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 4/5] vhost-user-dev: Add cache BAR
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v3 4/5] vhost-user-dev: Add cache BAR |
Date: |
Tue, 17 Sep 2024 10:32:58 +0200 |
On Thu, Sep 12, 2024 at 04:53:34PM +0200, Albert Esteve wrote:
> @@ -331,6 +333,37 @@ static void vub_device_realize(DeviceState *dev, Error
> **errp)
> do_vhost_user_cleanup(vdev, vub);
> }
>
> + ret = vub->vhost_dev.vhost_ops->vhost_get_shmem_config(&vub->vhost_dev,
> + &nregions,
> + memory_sizes,
> + errp);
> +
> + if (ret < 0) {
> + do_vhost_user_cleanup(vdev, vub);
> + }
> +
> + for (i = 0; i < nregions; i++) {
> + if (memory_sizes[i]) {
> + if (memory_sizes[i] % qemu_real_host_page_size() != 0) {
> + error_setg(errp, "Shared memory %d size must be a power of 2
> "
> + "no smaller than the page size", i);
> + return;
> + }
> +
> + cache_ptr = mmap(NULL, memory_sizes[i], PROT_NONE,
> + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
> + if (cache_ptr == MAP_FAILED) {
> + error_setg_errno(errp, errno, "Unable to mmap blank cache");
> + return;
> + }
> +
> + virtio_new_shmem_region(vdev);
> + memory_region_init_ram_ptr(vdev->shmem_list[i].mr,
I don't think this works because virtio_new_shmem_region() leaves .mr =
NULL? Why allocates the MemoryRegion and assigns it to shmem_list[i].mr?
signature.asc
Description: PGP signature
- [PATCH v3 0/5] vhost-user: Add SHMEM_MAP/UNMAP requests, Albert Esteve, 2024/09/12
- [PATCH v3 1/5] vhost-user: Add VIRTIO Shared Memory map request, Albert Esteve, 2024/09/12
- [PATCH v3 2/5] virtio: Track shared memory mappings, Albert Esteve, 2024/09/12
- [PATCH v3 3/5] vhost_user: Add frontend command for shmem config, Albert Esteve, 2024/09/12
- [PATCH v3 4/5] vhost-user-dev: Add cache BAR, Albert Esteve, 2024/09/12
- [PATCH v3 5/5] vhost_user: Add MEM_READ/WRITE backend requests, Albert Esteve, 2024/09/12
- Re: [PATCH v3 0/5] vhost-user: Add SHMEM_MAP/UNMAP requests, Albert Esteve, 2024/09/12
- Re: [PATCH v3 0/5] vhost-user: Add SHMEM_MAP/UNMAP requests, Stefan Hajnoczi, 2024/09/16