All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Paul Durrant <paul.durrant@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Keir Fraser <keir@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v4 08/17] x86/hvm: unify dpci portio intercept with standard portio intercept
Date: Wed, 24 Jun 2015 14:46:21 +0100	[thread overview]
Message-ID: <558AD0CD0200007800088F3D@mail.emea.novell.com> (raw)
In-Reply-To: <1435145089-21999-9-git-send-email-paul.durrant@citrix.com>

>>> On 24.06.15 at 13:24, <paul.durrant@citrix.com> wrote:
> @@ -237,16 +234,13 @@ static struct hvm_io_handler *hvm_find_io_handler(ioreq_t *p)
>  {
>      struct vcpu *curr = current;
>      struct domain *curr_d = curr->domain;
> -    const struct hvm_io_ops *ops =
> -        (p->type == IOREQ_TYPE_COPY) ?
> -        &mmio_ops :
> -        &portio_ops;
>      unsigned int i;
>  
>      for ( i = 0; i < curr_d->arch.hvm_domain.io_handler_count; i++ )
>      {
>          struct hvm_io_handler *handler =
>              &curr_d->arch.hvm_domain.io_handler[i];
> +        const struct hvm_io_ops *ops = handler->ops;

Which highlights that handler should probably also become const
(right where being introduced).

> --- a/xen/arch/x86/hvm/io.c
> +++ b/xen/arch/x86/hvm/io.c
> @@ -208,185 +208,100 @@ void hvm_io_assist(ioreq_t *p)
>      }
>  }
>  
> -static int dpci_ioport_read(uint32_t mport, ioreq_t *p)
> +static bool_t dpci_portio_accept(struct hvm_io_handler *handler,
> +                                 uint64_t addr,
> +                                 uint64_t size)
>  {
> -    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
> -    int rc = X86EMUL_OKAY, i, step = p->df ? -p->size : p->size;
> -    uint32_t data = 0;
> +    struct vcpu *curr = current;
> +    struct hvm_iommu *hd = domain_hvm_iommu(curr->domain);
> +    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
> +    struct g2m_ioport *g2m_ioport;
> +    uint32_t start, end;
> +    uint32_t gport = addr, mport;

All four of them should be unsigned int. And the same would again
apply to earlier patches. There's no need for port numbers to be
fixed width other than uint16_t (which would be inefficient for
other reasons).

> + found:
> +    mport = (gport - start) + g2m_ioport->mport;
>  
> -    return rc;
> +    vio->g2m_ioport = g2m_ioport;
> +    return 1;
>  }

The value calculated into mport is not used.

> --- a/xen/include/asm-x86/hvm/io.h
> +++ b/xen/include/asm-x86/hvm/io.h
> @@ -48,6 +48,8 @@ struct hvm_mmio_ops {
>  typedef int (*portio_action_t)(
>      int dir, uint32_t port, uint32_t bytes, uint32_t *val);
>  
> +struct hvm_io_ops;

This is not needed in an internal header when the use is ...

> @@ -58,6 +60,7 @@ struct hvm_io_handler {
>              portio_action_t action;
>          } portio;
>      } u;
> +    const struct hvm_io_ops *ops;

... in a structure, union, return value of a function, or declaration
of a global variable. Only function parameter types require such.

> --- a/xen/include/asm-x86/hvm/vcpu.h
> +++ b/xen/include/asm-x86/hvm/vcpu.h
> @@ -77,6 +77,8 @@ struct hvm_vcpu_io {
>      bool_t mmio_retry, mmio_retrying;
>  
>      unsigned long msix_unmask_address;
> +
> +    struct g2m_ioport *g2m_ioport;
>  };

I think this should be const, documenting that users of the field
won't modify what it points to.

Jan

  reply	other threads:[~2015-06-24 13:46 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 11:24 [PATCH v4 00/17] x86/hvm: I/O emulation cleanup and fix Paul Durrant
2015-06-24 11:24 ` [PATCH v4 01/17] x86/hvm: simplify hvmemul_do_io() Paul Durrant
2015-06-24 11:24 ` [PATCH v4 02/17] x86/hvm: remove hvm_io_pending() check in hvmemul_do_io() Paul Durrant
2015-06-24 11:24 ` [PATCH v4 03/17] x86/hvm: remove extraneous parameter from hvmtrace_io_assist() Paul Durrant
2015-06-24 11:24 ` [PATCH v4 04/17] x86/hvm: remove multiple open coded 'chunking' loops Paul Durrant
2015-06-24 12:33   ` Jan Beulich
2015-06-24 12:59     ` Paul Durrant
2015-06-24 13:09       ` Jan Beulich
2015-06-24 11:24 ` [PATCH v4 05/17] x86/hvm: re-name struct hvm_mmio_handler to hvm_mmio_ops Paul Durrant
2015-06-24 11:24 ` [PATCH v4 06/17] x86/hvm: unify internal portio and mmio intercepts Paul Durrant
2015-06-24 11:24 ` [PATCH v4 07/17] x86/hvm: add length to mmio check op Paul Durrant
2015-06-24 13:08   ` Jan Beulich
2015-06-24 13:14     ` Paul Durrant
2015-06-24 13:25       ` Jan Beulich
2015-06-24 13:34         ` Paul Durrant
2015-06-24 14:01           ` Jan Beulich
2015-06-25 12:21   ` Andrew Cooper
2015-06-25 12:46     ` Jan Beulich
2015-06-25 13:08       ` Paul Durrant
2015-06-25 13:29         ` Jan Beulich
2015-06-25 13:30           ` Paul Durrant
2015-06-25 13:34       ` Andrew Cooper
2015-06-25 13:36         ` Paul Durrant
2015-06-25 13:37           ` Andrew Cooper
2015-06-25 13:38             ` Paul Durrant
2015-06-25 13:46               ` Andrew Cooper
2015-06-25 13:48                 ` Paul Durrant
2015-06-25 13:47           ` Jan Beulich
2015-06-25 13:52             ` Paul Durrant
2015-06-25 14:46               ` Jan Beulich
2015-06-25 14:57                 ` Paul Durrant
2015-06-24 11:24 ` [PATCH v4 08/17] x86/hvm: unify dpci portio intercept with standard portio intercept Paul Durrant
2015-06-24 13:46   ` Jan Beulich [this message]
2015-06-24 11:24 ` [PATCH v4 09/17] x86/hvm: unify stdvga mmio intercept with standard mmio intercept Paul Durrant
2015-06-24 13:59   ` Jan Beulich
2015-06-24 14:12     ` Paul Durrant
2015-06-24 14:30       ` Jan Beulich
2015-06-24 14:43         ` Paul Durrant
2015-06-24 11:24 ` [PATCH v4 10/17] x86/hvm: revert 82ed8716b "fix direct PCI port I/O emulation retry Paul Durrant
2015-06-24 15:21   ` Jan Beulich
2015-06-24 15:23     ` Paul Durrant
2015-06-24 11:24 ` [PATCH v4 11/17] x86/hvm: only call hvm_io_assist() from hvm_wait_for_io() Paul Durrant
2015-06-24 15:36   ` Jan Beulich
2015-06-24 15:50     ` Paul Durrant
2015-06-24 11:24 ` [PATCH v4 12/17] x86/hvm: split I/O completion handling from state model Paul Durrant
2015-06-25  9:40   ` Jan Beulich
2015-06-25 15:59     ` Paul Durrant
2015-06-24 11:24 ` [PATCH v4 13/17] x86/hvm: remove HVMIO_dispatched I/O state Paul Durrant
2015-06-24 15:52   ` Jan Beulich
2015-06-24 16:00     ` Paul Durrant
2015-06-24 16:12       ` Jan Beulich
2015-06-24 17:00         ` Paul Durrant
2015-06-25 12:29   ` Andrew Cooper
2015-06-24 11:24 ` [PATCH v4 14/17] x86/hvm: remove hvm_io_state enumeration Paul Durrant
2015-06-25  9:43   ` Jan Beulich
2015-06-25  9:46     ` Paul Durrant
2015-06-24 11:24 ` [PATCH v4 15/17] x86/hvm: use ioreq_t to track in-flight state Paul Durrant
2015-06-25  9:51   ` Jan Beulich
2015-06-25 10:17     ` Paul Durrant
2015-06-24 11:24 ` [PATCH v4 16/17] x86/hvm: always re-emulate I/O from a buffer Paul Durrant
2015-06-25  9:57   ` Jan Beulich
2015-06-25 10:32     ` Paul Durrant
2015-06-25 10:50       ` Jan Beulich
2015-06-25 10:52         ` Paul Durrant
2015-06-24 11:24 ` [PATCH v4 17/17] x86/hvm: track large memory mapped accesses by buffer offset Paul Durrant
2015-06-25 10:46   ` Jan Beulich
2015-06-25 10:51     ` Paul Durrant
2015-06-25 11:05       ` Jan Beulich
2015-06-25 10:55     ` Paul Durrant
2015-06-25 11:08       ` Jan Beulich
2015-06-24 12:16 ` [PATCH v4 00/17] x86/hvm: I/O emulation cleanup and fix Jan Beulich
2015-06-24 12:52   ` Paul Durrant

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=558AD0CD0200007800088F3D@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=keir@xen.org \
    --cc=paul.durrant@citrix.com \
    --cc=xen-devel@lists.xenproject.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.