All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuval Shaia <yuval.shaia@oracle.com>
To: Marcel Apfelbaum <marcel@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	yuval.shaia@oracle.com
Subject: Re: [Qemu-devel] [PATCH PULL v2 09/10] hw/rdma: Implementation of PVRDMA device
Date: Sun, 29 Apr 2018 12:38:04 +0300	[thread overview]
Message-ID: <20180429093803.GD2597@yuvallap> (raw)
In-Reply-To: <8659dc43-a5a2-f4ca-3381-8698a1a06ad3@redhat.com>

On Fri, Apr 27, 2018 at 10:36:33PM +0300, Marcel Apfelbaum wrote:
> On 27/04/2018 17:49, Peter Maydell wrote:
> > On 19 February 2018 at 11:43, Marcel Apfelbaum <marcel@redhat.com> wrote:
> >> From: Yuval Shaia <yuval.shaia@oracle.com>
> >>
> >> PVRDMA is the QEMU implementation of VMware's paravirtualized RDMA device.
> >> It works with its Linux Kernel driver AS IS, no need for any special
> >> guest modifications.
> >>
> >> While it complies with the VMware device, it can also communicate with
> >> bare metal RDMA-enabled machines and does not require an RDMA HCA in the
> >> host, it can work with Soft-RoCE (rxe).
> >>
> >> It does not require the whole guest RAM to be pinned allowing memory
> >> over-commit and, even if not implemented yet, migration support will be
> >> possible with some HW assistance.
> >>
> >> Implementation is divided into 2 components, rdma general and pvRDMA
> >> specific functions and structures.
> >>
> >> The second PVRDMA sub-module - interaction with PCI layer.
> >> - Device configuration and setup (MSIX, BARs etc).
> >> - Setup of DSR (Device Shared Resources)
> >> - Setup of device ring.
> >> - Device management.
> >>
> >> Reviewed-by: Dotan Barak <dotanb@mellanox.com>
> >> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> >> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> >> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> > 
> > Hi; this is something odd I noticed reading through the code.
> > 
> >> +static void init_bars(PCIDevice *pdev)
> >> +{
> >> +    PVRDMADev *dev = PVRDMA_DEV(pdev);
> >> +
> >> +    /* BAR 0 - MSI-X */
> >> +    memory_region_init(&dev->msix, OBJECT(dev), "pvrdma-msix",
> >> +                       RDMA_BAR0_MSIX_SIZE);
> >> +    pci_register_bar(pdev, RDMA_MSIX_BAR_IDX, PCI_BASE_ADDRESS_SPACE_MEMORY,
> >> +                     &dev->msix);
> >> +
> >> +    /* BAR 1 - Registers */
> >> +    memset(&dev->regs_data, 0, sizeof(dev->regs_data));
> >> +    memory_region_init_io(&dev->regs, OBJECT(dev), &regs_ops, dev,
> >> +                          "pvrdma-regs", RDMA_BAR1_REGS_SIZE);
> > 
> > RDMA_BAR1_REGS_SIZE is used in pvrdma.h to declare the regs array:
> >     uint32_t regs_data[RDMA_BAR1_REGS_SIZE];
> > and that and the way that get_reg_val/set_reg_val do "addr >> 2" to
> > convert from an address to an array index suggest that it is the
> > size of the BAR in 32-bit words. However here we're passing it
> > as the size parameter of memory_region_init_io(), which wants a
> > size in bytes. Which is correct ?
> > 
> 
> I think that RDMA_BAR1_REGS_SIZE (256) is the size in bytes,
> this is the layout of the registers (linux kernel):
> 
> /* Register offsets within PCI resource on BAR1. */
> #define PVRDMA_REG_VERSION      0x00    /* R: Version of device. */
> #define PVRDMA_REG_DSRLOW       0x04    /* W: Device shared region low PA. */
> #define PVRDMA_REG_DSRHIGH      0x08    /* W: Device shared region high PA. */
> #define PVRDMA_REG_CTL          0x0c    /* W: PVRDMA_DEVICE_CTL */
> #define PVRDMA_REG_REQUEST      0x10    /* W: Indicate device request. */
> #define PVRDMA_REG_ERR          0x14    /* R: Device error. */
> #define PVRDMA_REG_ICR          0x18    /* R: Interrupt cause. */
> #define PVRDMA_REG_IMR          0x1c    /* R/W: Interrupt mask. */
> #define PVRDMA_REG_MACL         0x20    /* R/W: MAC address low. */
> #define PVRDMA_REG_MACH         0x24    /* R/W: MAC address high. */
> 
> So we don't need 256 32-bit words.
> Yuval can you please confirm?

Correct, will make it smaller while taking care for the reported size in
call to memory_region_init.

Yuval

> 
> 
> Thanks,
> Marcel
> 
> > thanks
> > -- PMM
> > 
> 

  reply	other threads:[~2018-04-29  9:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 11:43 [Qemu-devel] [PATCH PULL v2 00/10] RDMA patches Marcel Apfelbaum
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 01/10] mem: add share parameter to memory-backend-ram Marcel Apfelbaum
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 02/10] docs: add pvrdma device documentation Marcel Apfelbaum
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 03/10] scripts/update-linux-headers: import pvrdma headers Marcel Apfelbaum
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 04/10] include/standard-headers: add pvrdma related headers Marcel Apfelbaum
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 05/10] hw/rdma: Add wrappers and macros Marcel Apfelbaum
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 06/10] hw/rdma: Definitions for rdma device and rdma resource manager Marcel Apfelbaum
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 07/10] hw/rdma: Implementation of generic rdma device layers Marcel Apfelbaum
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 08/10] hw/rdma: PVRDMA commands and data-path ops Marcel Apfelbaum
2018-04-27 14:31   ` Peter Maydell
2018-04-27 18:20     ` Marcel Apfelbaum
2018-04-29  7:42       ` Yuval Shaia
2018-04-27 14:43   ` Peter Maydell
2018-04-27 18:22     ` Marcel Apfelbaum
2018-04-27 14:58   ` Peter Maydell
2018-04-27 18:28     ` Marcel Apfelbaum
2018-04-27 15:01   ` Peter Maydell
2018-04-27 18:31     ` Marcel Apfelbaum
2023-06-20 12:35   ` Peter Maydell
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 09/10] hw/rdma: Implementation of PVRDMA device Marcel Apfelbaum
2018-04-27 14:49   ` Peter Maydell
2018-04-27 19:36     ` Marcel Apfelbaum
2018-04-29  9:38       ` Yuval Shaia [this message]
2018-04-27 14:55   ` Peter Maydell
2018-04-27 19:46     ` Marcel Apfelbaum
2018-04-29  7:18     ` Yuval Shaia
2018-02-19 11:43 ` [Qemu-devel] [PATCH PULL v2 10/10] MAINTAINERS: add entry for hw/rdma Marcel Apfelbaum
2018-02-19 16:43 ` [Qemu-devel] [PATCH PULL v2 00/10] RDMA patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180429093803.GD2597@yuvallap \
    --to=yuval.shaia@oracle.com \
    --cc=marcel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.