From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [kvm-unit-tests PATCH v2 05/10] x86: move x86/pci to the common lib Date: Fri, 15 Jan 2016 22:57:09 +0100 Message-ID: <20160115215708.GB11566@potion.brq.redhat.com> References: <1452876695-9240-1-git-send-email-drjones@redhat.com> <1452876695-9240-6-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, pbonzini@redhat.com, mst@redhat.com, agordeev@redhat.com To: Andrew Jones Return-path: Received: from mx1.redhat.com ([209.132.183.28]:37243 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755716AbcAOV5M (ORCPT ); Fri, 15 Jan 2016 16:57:12 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id B3D658F4E5 for ; Fri, 15 Jan 2016 21:57:12 +0000 (UTC) Content-Disposition: inline In-Reply-To: <1452876695-9240-6-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 2016-01-15 17:51+0100, Andrew Jones: > Also move pci_config_read into asm/pci.h > > Signed-off-by: Andrew Jones > --- > +++ b/lib/asm-generic/pci.h > @@ -0,0 +1,4 @@ > +#ifndef _ASM_GENERIC_PCI_H_ > +#define _ASM_GENERIC_PCI_H_ > +#error need architecture specific asm/pci.h > +#endif > +++ b/lib/x86/asm/pci.h > @@ -0,0 +1,19 @@ > +#ifndef ASM_PCI_H > +#define ASM_PCI_H > +/* > + * Copyright (C) 2013, Red Hat Inc, Michael S. Tsirkin > + * > + * This work is licensed under the terms of the GNU LGPL, version 2. > + */ > +#include "libcflat.h" > +#include "pci.h" > +#include "asm/io.h" > + > +static inline uint32_t pci_config_read(pcidevaddr_t dev, uint8_t reg) > +{ > + uint32_t index = reg | (dev << 8) | (0x1 << 31); > + outl(index, 0xCF8); > + return inl(0xCFC); Hm, why can't this be generalized with [1/10]? Thanks. > +} > + > +#endif