From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shuai Ruan Subject: [V9 1/3] Remove identical relationship between ioreq type and rangeset type. Date: Tue, 15 Dec 2015 10:05:08 +0800 Message-ID: <1450145110-2860-2-git-send-email-shuai.ruan@linux.intel.com> References: <1450145110-2860-1-git-send-email-shuai.ruan@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1450145110-2860-1-git-send-email-shuai.ruan@linux.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: kevin.tian@intel.com, wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, Paul.Durrant@citrix.com, zhiyuan.lv@intel.com, jbeulich@suse.com, keir@xen.org List-Id: xen-devel@lists.xenproject.org From: Yu Zhang This patch uses HVMOP_IO_RANGE_XXX values rather than the raw ioreq type to select the ioreq server, therefore the identical relationship between ioreq type and rangeset type is no longer necessary. Signed-off-by: Yu Zhang Reviewed-by: Paul Durrant Signed-off-by: Shuai Ruan Acked-by: Jan Beulich --- xen/arch/x86/hvm/hvm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 92d57ff..2197e9b 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2572,7 +2572,7 @@ struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d, PCI_SLOT(CF8_BDF(cf8)), PCI_FUNC(CF8_BDF(cf8))); - type = IOREQ_TYPE_PCI_CONFIG; + type = HVMOP_IO_RANGE_PCI; addr = ((uint64_t)sbdf << 32) | CF8_ADDR_LO(cf8) | (p->addr & 3); @@ -2590,7 +2590,8 @@ struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d, } else { - type = p->type; + type = (p->type == IOREQ_TYPE_PIO) ? + HVMOP_IO_RANGE_PORT : HVMOP_IO_RANGE_MEMORY; addr = p->addr; } @@ -2606,31 +2607,28 @@ struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d, if ( !s->enabled ) continue; - BUILD_BUG_ON(IOREQ_TYPE_PIO != HVMOP_IO_RANGE_PORT); - BUILD_BUG_ON(IOREQ_TYPE_COPY != HVMOP_IO_RANGE_MEMORY); - BUILD_BUG_ON(IOREQ_TYPE_PCI_CONFIG != HVMOP_IO_RANGE_PCI); r = s->range[type]; switch ( type ) { unsigned long end; - case IOREQ_TYPE_PIO: + case HVMOP_IO_RANGE_PORT: end = addr + p->size - 1; if ( rangeset_contains_range(r, addr, end) ) return s; break; - case IOREQ_TYPE_COPY: + case HVMOP_IO_RANGE_MEMORY: end = addr + (p->size * p->count) - 1; if ( rangeset_contains_range(r, addr, end) ) return s; break; - case IOREQ_TYPE_PCI_CONFIG: + case HVMOP_IO_RANGE_PCI: if ( rangeset_contains_singleton(r, addr >> 32) ) { - p->type = type; + p->type = IOREQ_TYPE_PCI_CONFIG; p->addr = addr; return s; } -- 1.9.1