From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: joro@8bytes.org, kvm@vger.kernel.org, qemu-devel@nongnu.org,
avi@redhat.com, paul@codesourcery.com
Subject: Re: [Qemu-devel] [RFC PATCH 2/4] AMD IOMMU emulation
Date: Fri, 6 Aug 2010 03:41:04 +0300 [thread overview]
Message-ID: <20100806004103.GA19337@localhost> (raw)
In-Reply-To: <AANLkTikKYWBaXE1s=J2O=+wF9WCZ-4rSHMWx0uxycUgn@mail.gmail.com>
On Thu, Aug 05, 2010 at 09:31:58PM +0000, Blue Swirl wrote:
> On Wed, Aug 4, 2010 at 10:32 PM, Eduard - Gabriel Munteanu
> <eduard.munteanu@linux360.ro> wrote:
[snip]
> > diff --git a/Makefile.target b/Makefile.target
> > index 70a9c1b..86226a0 100644
> > --- a/Makefile.target
> > +++ b/Makefile.target
> > @@ -219,6 +219,8 @@ obj-i386-y += pcspk.o i8254.o
> > ??obj-i386-$(CONFIG_KVM_PIT) += i8254-kvm.o
> > ??obj-i386-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += device-assignment.o
> >
> > +obj-i386-$(CONFIG_AMD_IOMMU) += amd_iommu.o
>
> Make this unconditional.
>
[snip]
>
> Drop all configure changes.
>
Alright, so it's not going to be a compile-time configurable option.
I'll make some cmdline option for it and make really sure I don't mess
performance in hot paths.
(I'm actually happy to know it's gonna go in that way.)
[snip]
> > +struct amd_iommu_invalidator {
> > + ?? ??int ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? devfn;
> > + ?? ??PCIInvalidateIOTLBFunc ??*func;
> > + ?? ??void ?? ?? ?? ?? ?? ?? ?? ?? ?? ??*opaque;
> > + ?? ??QLIST_ENTRY(amd_iommu_invalidator) list;
> > +};
>
> This should be AMDIOMMUInvalidator with typedef.
>
> > +
> > +struct amd_iommu_state {
[snip]
> > +};
>
> Likewise, AMDIOMMUState.
>
[snip]
> > +static int amd_iommu_translate(PCIIOMMU *iommu,
> > + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? PCIDevice *dev,
> > + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? pci_addr_t addr,
> > + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? target_phys_addr_t *paddr,
> > + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? int *len,
> > + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? unsigned perms);
>
> Please move the implementation here to avoid this declaration.
>
[snip]
> > + ?? ??iommu = qemu_mallocz(sizeof(PCIIOMMU));
> > + ?? ??iommu->opaque = st;
> > + ?? ??iommu->translate = amd_iommu_translate;
> > + ?? ??iommu->register_iotlb_invalidator = amd_iommu_register_invalidator;
> > + ?? ??pci_register_iommu(dev, iommu);
>
> I'd avoid the structure and just pass the stuff to pci_register_iommu
> as function arguments.
>
[snip]
> > +void amd_iommu_init(PCIBus *bus)
> > +{
> > + ?? ??pci_create_simple(bus, -1, "amd-iommu");
> > +}
>
> Just open code this in pc.c.
>
Roger, I'll fix these.
[snip]
> > ??#define PCI_VENDOR_ID_MOTOROLA ?? ?? ?? ?? ?? 0x1057
> > ??#define PCI_DEVICE_ID_MOTOROLA_MPC106 ?? ??0x0002
> > diff --git a/hw/pci_regs.h b/hw/pci_regs.h
> > index 1c675dc..6399b5d 100644
> > --- a/hw/pci_regs.h
> > +++ b/hw/pci_regs.h
> > @@ -216,6 +216,7 @@
> > ??#define ??PCI_CAP_ID_SHPC ?? ?? ?? 0x0C ?? ??/* PCI Standard Hot-Plug Controller */
> > ??#define ??PCI_CAP_ID_SSVID ?? ?? ??0x0D ?? ??/* Bridge subsystem vendor/device ID */
> > ??#define ??PCI_CAP_ID_AGP3 ?? ?? ?? 0x0E ?? ??/* AGP Target PCI-PCI bridge */
> > +#define ??PCI_CAP_ID_SEC ?? ?? 0x0F ?? ??/* Secure Device (AMD IOMMU) */
>
> Indentation seems to be off.
>
> > ??#define ??PCI_CAP_ID_EXP ?? ?? ?? ??0x10 ?? ??/* PCI Express */
> > ??#define ??PCI_CAP_ID_MSIX ?? ?? ?? 0x11 ?? ??/* MSI-X */
> > ??#define ??PCI_CAP_ID_AF ?? ?? ?? ?? 0x13 ?? ??/* PCI Advanced Features */
> > --
> > 1.7.1
The original has tabs instead of spaces, but my changes line up
properly. Which way should I go, convert it all to spaces, add my line
with tabs or leave it like this? Of course, any cleanup would go in a
separate patch.
Thanks,
Eduard
next prev parent reply other threads:[~2010-08-06 0:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-04 22:32 [RFC PATCH 0/4] AMD IOMMU emulation 2nd version Eduard - Gabriel Munteanu
2010-08-04 22:32 ` [RFC PATCH 1/4] pci: memory access API and IOMMU support Eduard - Gabriel Munteanu
2010-08-05 21:23 ` [Qemu-devel] " Blue Swirl
2010-08-06 0:21 ` Eduard - Gabriel Munteanu
2010-08-04 22:32 ` [RFC PATCH 2/4] AMD IOMMU emulation Eduard - Gabriel Munteanu
2010-08-05 21:31 ` [Qemu-devel] " Blue Swirl
2010-08-06 0:41 ` Eduard - Gabriel Munteanu [this message]
2010-08-04 22:32 ` [RFC PATCH 3/4] ide: use the PCI memory access interface Eduard - Gabriel Munteanu
2010-08-04 22:32 ` [RFC PATCH 4/4] rtl8139: " Eduard - Gabriel Munteanu
2010-08-05 21:13 ` [Qemu-devel] [RFC PATCH 0/4] AMD IOMMU emulation 2nd version Blue Swirl
2010-08-06 14:09 ` Question about starting 2 VMs using Qemu Anjali Kulkarni
2010-08-07 17:43 ` Question about e1000 NIC emulation in Qemu - chipset used Anjali Kulkarni
2010-08-09 1:49 ` Question about starting 2 VMs using Qemu haishan
2010-08-09 22:18 ` Nirmal Guhan
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=20100806004103.GA19337@localhost \
--to=eduard.munteanu@linux360.ro \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox