From: "Jan Beulich" Subject: Re: [PATCH v7 03/15] x86/hvm: restrict port numbers and uint16_t and sizes to unsigned int Date: Thu, 09 Jul 2015 16:24:01 +0100 Message-ID: <559EAE31020000780008EED9@mail.emea.novell.com> References: <1436447455-11524-1-git-send-email-paul.durrant@citrix.com> <1436447455-11524-4-git-send-email-paul.durrant@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436447455-11524-4-git-send-email-paul.durrant@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Paul Durrant Cc: Keir Fraser , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 09.07.15 at 15:10, wrote: > Building on the previous patch, this patch restricts portio port numbers > to uint16_t in registration/relocate calls. In portio_action_t the port > number is change to unsigned int though to avoid the compiler generating > 16-bit operations unnecessarily. The patch also changes I/O sizes to > unsigned int which then allows the io_handler size field to reduce to > an unsigned int. > > Signed-off-by: Paul Durrant > Cc: Keir Fraser > Cc: Jan Beulich > Reviewed-by: Andrew Cooper > --- > > v7: > - Change port type in portio_action_t to unsigned int as requested > by Jan Yet title and description were left in places, and ... > @@ -96,17 +96,17 @@ int hvm_mmio_intercept(ioreq_t *p); > int hvm_buffered_io_send(ioreq_t *p); > > static inline void register_portio_handler( > - struct domain *d, unsigned long addr, > - unsigned long size, portio_action_t action) > + struct domain *d, uint16_t port, unsigned int size, > + portio_action_t action) > { > - register_io_handler(d, addr, size, action, HVM_PORTIO); > + register_io_handler(d, port, size, action, HVM_PORTIO); > } > > static inline void relocate_portio_handler( > - struct domain *d, unsigned long old_addr, unsigned long new_addr, > - unsigned long size) > + struct domain *d, uint16_t old_port, uint16_t new_port, > + unsigned int size) > { > - relocate_io_handler(d, old_addr, new_addr, size, HVM_PORTIO); > + relocate_io_handler(d, old_port, new_port, size, HVM_PORTIO); > } ... these still use uint16_t. I'm pretty sure I gave my comment in a way indicating that this should generally change, perhaps just at the example of portio_action_t. Jan