All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: jailhouse-dev@googlegroups.com, linux-pci@vger.kernel.org,
	x86@kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	virtualization@lists.linux-foundation.org,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH v4 3/7] x86/jailhouse: Enable PCI mmconfig access in inmates
Date: Sun,  4 Mar 2018 19:31:35 +0100	[thread overview]
Message-ID: <d780e72d7a0992c891f6787aa517f8f090cb54d9.1520188299.git.jan.kiszka__30937.8874990673$1520188278$gmane$org@siemens.com> (raw)
In-Reply-To: <cover.1520188299.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1520188299.git.jan.kiszka@siemens.com>

From: Otavio Pontes <otavio.pontes@intel.com>

Use the PCI mmconfig base address exported by jailhouse in boot
parameters in order to access the memory mapped PCI configuration space.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
[Jan: rebased, fixed !CONFIG_PCI_MMCONFIG, used pcibios_last_bus]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/include/asm/pci_x86.h | 2 ++
 arch/x86/kernel/jailhouse.c    | 8 ++++++++
 arch/x86/pci/mmconfig-shared.c | 4 ++--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index eb66fa9cd0fc..959d618dbb17 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -151,6 +151,8 @@ extern int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
 			       phys_addr_t addr);
 extern int pci_mmconfig_delete(u16 seg, u8 start, u8 end);
 extern struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus);
+extern struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
+							int end, u64 addr);
 
 extern struct list_head pci_mmcfg_list;
 
diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c
index b68fd895235a..fa183a131edc 100644
--- a/arch/x86/kernel/jailhouse.c
+++ b/arch/x86/kernel/jailhouse.c
@@ -124,6 +124,14 @@ static int __init jailhouse_pci_arch_init(void)
 	if (pcibios_last_bus < 0)
 		pcibios_last_bus = 0xff;
 
+#ifdef CONFIG_PCI_MMCONFIG
+	if (setup_data.pci_mmconfig_base) {
+		pci_mmconfig_add(0, 0, pcibios_last_bus,
+				 setup_data.pci_mmconfig_base);
+		pci_mmcfg_arch_init();
+	}
+#endif
+
 	return 0;
 }
 
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 96684d0adcf9..0e590272366b 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -94,8 +94,8 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start,
 	return new;
 }
 
-static struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
-							int end, u64 addr)
+struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
+						 int end, u64 addr)
 {
 	struct pci_mmcfg_region *new;
 
-- 
2.13.6

  parent reply	other threads:[~2018-03-04 18:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-04 18:31 [PATCH v4 0/7] jailhouse: Enhance secondary Jailhouse guest support /wrt PCI Jan Kiszka
2018-03-04 18:31 ` [PATCH v4 1/7] jailhouse: Provide detection for non-x86 systems Jan Kiszka
2018-03-04 18:31 ` Jan Kiszka
2018-03-04 18:31 ` [PATCH v4 2/7] PCI: Scan all functions when running over Jailhouse Jan Kiszka
2018-03-04 18:31 ` Jan Kiszka
2018-03-04 18:31 ` [PATCH v4 3/7] x86/jailhouse: Enable PCI mmconfig access in inmates Jan Kiszka
2018-03-05 15:36   ` Andy Shevchenko
2018-03-05 15:36   ` Andy Shevchenko
2018-03-04 18:31 ` Jan Kiszka [this message]
2018-03-04 18:31 ` [PATCH v4 4/7] x86: Align x86_64 PCI_MMCONFIG with 32-bit variant Jan Kiszka
2018-03-04 18:31 ` Jan Kiszka
2018-03-04 18:31 ` [PATCH v4 5/7] x86: Consolidate PCI_MMCONFIG configs Jan Kiszka
2018-03-04 18:31 ` Jan Kiszka
2018-03-04 18:31 ` [PATCH v4 6/7] x86/jailhouse: Allow to use PCI_MMCONFIG without ACPI Jan Kiszka
2018-03-04 18:31 ` Jan Kiszka
2018-03-06  0:41   ` kbuild test robot
2018-03-06  0:41   ` kbuild test robot
2018-03-04 18:31 ` [PATCH v4 7/7] MAINTAINERS: Add entry for Jailhouse Jan Kiszka
2018-03-04 18:31 ` Jan Kiszka

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='d780e72d7a0992c891f6787aa517f8f090cb54d9.1520188299.git.jan.kiszka__30937.8874990673$1520188278$gmane$org@siemens.com' \
    --to=jan.kiszka@siemens.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=hpa@zytor.com \
    --cc=jailhouse-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.