From patchwork Thu Apr 17 14:57:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 4009191 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F1B689F2CC for ; Thu, 17 Apr 2014 14:58:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C10B20364 for ; Thu, 17 Apr 2014 14:58:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B4B220212 for ; Thu, 17 Apr 2014 14:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751803AbaDQO54 (ORCPT ); Thu, 17 Apr 2014 10:57:56 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:51857 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751217AbaDQO5y (ORCPT ); Thu, 17 Apr 2014 10:57:54 -0400 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.157]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s3HEvowo006601; Thu, 17 Apr 2014 15:57:50 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id A50E41AE1037; Thu, 17 Apr 2014 15:57:50 +0100 (BST) From: Will Deacon To: kvm@vger.kernel.org Cc: penberg@kernel.org, Will Deacon Subject: [PATCH 1/2] kvm tools: ARM: bring generated pci FDT node in-line with kernel binding Date: Thu, 17 Apr 2014 15:57:47 +0100 Message-Id: <1397746668-29060-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 1.9.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that the dust has settled on the devicetree bindings for the generic PCI host controller in the Linux kernel, update the node generated by kvmtool to match what mainline kernels will expect. Signed-off-by: Will Deacon --- tools/kvm/arm/fdt.c | 1 + tools/kvm/arm/kvm.c | 5 ----- tools/kvm/arm/pci.c | 25 ++++++++++++------------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/tools/kvm/arm/fdt.c b/tools/kvm/arm/fdt.c index d90fc9e1734f..30cd75ab89d4 100644 --- a/tools/kvm/arm/fdt.c +++ b/tools/kvm/arm/fdt.c @@ -114,6 +114,7 @@ static int setup_fdt(struct kvm *kvm) /* /chosen */ _FDT(fdt_begin_node(fdt, "chosen")); + _FDT(fdt_property_cell(fdt, "linux,pci-probe-only", 1)); _FDT(fdt_property_string(fdt, "bootargs", kern_cmdline)); /* Initrd */ diff --git a/tools/kvm/arm/kvm.c b/tools/kvm/arm/kvm.c index 6db646b4f4fd..008b7fe75d7d 100644 --- a/tools/kvm/arm/kvm.c +++ b/tools/kvm/arm/kvm.c @@ -56,11 +56,6 @@ void kvm__arch_read_term(struct kvm *kvm) void kvm__arch_set_cmdline(char *cmdline, bool video) { - /* - * We don't support movable BARs, so force the guest to use what - * we tell it. - */ - strcpy(cmdline, "pci=firmware"); } void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size) diff --git a/tools/kvm/arm/pci.c b/tools/kvm/arm/pci.c index ce1932ecc3ee..9f4dabcd4ed4 100644 --- a/tools/kvm/arm/pci.c +++ b/tools/kvm/arm/pci.c @@ -26,19 +26,15 @@ void pci__generate_fdt_nodes(void *fdt, u32 gic_phandle) struct device_header *dev_hdr; struct of_interrupt_map_entry irq_map[OF_PCI_IRQ_MAP_MAX]; unsigned nentries = 0; - /* Describe the memory ranges (config and memory) */ + /* Bus range */ + u32 bus_range[] = { cpu_to_fdt32(0), cpu_to_fdt32(1), }; + /* Configuration Space */ + u64 cfg_reg_prop[] = { cpu_to_fdt64(KVM_PCI_CFG_AREA), + cpu_to_fdt64(ARM_PCI_CFG_SIZE), }; + /* Describe the memory ranges */ struct of_pci_ranges_entry ranges[] = { { .pci_addr = { - .hi = cpu_to_fdt32(of_pci_b_ss(OF_PCI_SS_CONFIG)), - .mid = 0, - .lo = 0, - }, - .cpu_addr = cpu_to_fdt64(KVM_PCI_CFG_AREA), - .length = cpu_to_fdt64(ARM_PCI_CFG_SIZE), - }, - { - .pci_addr = { .hi = cpu_to_fdt32(of_pci_b_ss(OF_PCI_SS_IO)), .mid = 0, .lo = 0, @@ -49,8 +45,8 @@ void pci__generate_fdt_nodes(void *fdt, u32 gic_phandle) { .pci_addr = { .hi = cpu_to_fdt32(of_pci_b_ss(OF_PCI_SS_M32)), - .mid = 0, - .lo = 0, + .mid = cpu_to_fdt32(KVM_PCI_MMIO_AREA >> 32), + .lo = cpu_to_fdt32(KVM_PCI_MMIO_AREA), }, .cpu_addr = cpu_to_fdt64(KVM_PCI_MMIO_AREA), .length = cpu_to_fdt64(ARM_PCI_MMIO_SIZE), @@ -59,11 +55,14 @@ void pci__generate_fdt_nodes(void *fdt, u32 gic_phandle) /* Boilerplate PCI properties */ _FDT(fdt_begin_node(fdt, "pci")); + _FDT(fdt_property_string(fdt, "device_type", "pci")); _FDT(fdt_property_cell(fdt, "#address-cells", 0x3)); _FDT(fdt_property_cell(fdt, "#size-cells", 0x2)); _FDT(fdt_property_cell(fdt, "#interrupt-cells", 0x1)); - _FDT(fdt_property_string(fdt, "compatible", "linux,pci-virt")); + _FDT(fdt_property_string(fdt, "compatible", "pci-host-cam-generic")); + _FDT(fdt_property(fdt, "bus-range", bus_range, sizeof(bus_range))); + _FDT(fdt_property(fdt, "reg", &cfg_reg_prop, sizeof(cfg_reg_prop))); _FDT(fdt_property(fdt, "ranges", ranges, sizeof(ranges))); /* Generate the interrupt map ... */