From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 601EC2EDA for ; Wed, 16 Dec 2015 15:23:13 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 16 Dec 2015 06:23:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,437,1444719600"; d="scan'208";a="842453507" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by orsmga001.jf.intel.com with ESMTP; 16 Dec 2015 06:23:11 -0800 Date: Wed, 16 Dec 2015 22:23:26 +0800 From: Yuanhan Liu To: Santosh Shukla Message-ID: <20151216142326.GV29571@yliu-dev.sh.intel.com> References: <1450098032-21198-1-git-send-email-sshukla@mvista.com> <1450098032-21198-6-git-send-email-sshukla@mvista.com> <20151216134850.GU29571@yliu-dev.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2015 14:23:13 -0000 On Wed, Dec 16, 2015 at 07:31:57PM +0530, Santosh Shukla wrote: > On Wed, Dec 16, 2015 at 7:18 PM, Yuanhan Liu > wrote: > > On Mon, Dec 14, 2015 at 06:30:24PM +0530, Santosh Shukla wrote: > >> In x86 case io_base to store ioport address not more than 65535 ioports. i.e..0 > >> to ffff but in non-x86 case in particular arm64 it need to store more than 32 > >> bit address so changing io_base datatype from 32 to 64. > >> > >> Signed-off-by: Santosh Shukla > >> --- > >> drivers/net/virtio/virtio_ethdev.c | 2 +- > >> drivers/net/virtio/virtio_pci.h | 4 ++-- > >> 2 files changed, 3 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > >> index d928339..620e0d4 100644 > >> --- a/drivers/net/virtio/virtio_ethdev.c > >> +++ b/drivers/net/virtio/virtio_ethdev.c > >> @@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) > >> return -1; > >> > >> hw->use_msix = virtio_has_msix(&pci_dev->addr); > >> - hw->io_base = (uint32_t)(uintptr_t)pci_dev->mem_resource[0].addr; > >> + hw->io_base = (uint64_t)(uintptr_t)pci_dev->mem_resource[0].addr; > > > > I'd suggest to move the io_base assignment (and cast) into virtio_ioport_init() > > so that we could do the correct cast there, say cast it to uint32_t for > > X86, and uint64_t for others. > > > > Ok. > > This was deliberately done considering your 1.0 virtio spec patch do > care for uint64_t types and in arm64 case, If I plan to use those > future patches, IMO it make more sense to me keep it in uint64_t way; I did different cast, 32 bit for legacy virtio pci device, and 64 bit for modern virtio pci device. > Also in x86 case max address could of type 0x1000-101f and so forth; > changing data-type to uint64_t default wont effect such address, > right? Right, but what's the harm of doing the right cast? :) > And hw->io_base by looking at virtio_pci.h function like > inb/outb etc.. takes io_base address as unsigned long types which is > arch dependent; i.e.. 4 byte for 32 bit and 8 for 64 bit so the lower > level rd/wr apis are taking care of data-types accordingly. Didn't get it. inb/outb takes "unsigned short" arguments, but not "unsigned long". --yliu