From patchwork Thu May 14 09:19:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48483 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2C37E2121F for ; Thu, 14 May 2015 09:22:07 +0000 (UTC) Received: by layy10 with SMTP id y10sf18111009lay.0 for ; Thu, 14 May 2015 02:22:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=eeT5hC+6l9ektIQeDrckVM9SZFWc3U940aaW4ttGZtU=; b=NNoS2LIFzq6Os5+QA9qzVYoYQw5dSjbGQITn8L8lmAZs0HJ73sZoerwIsQAn4qy+33 +Ko5pLQxpF+pqPXRk7xz9HXtHG1TlcofqHVWgOs8MLWMSlSjCrv+22TcJbQKxgcq4KMC 7qZ9jRvVNlgPuQEBaxZk0HdSoI8e5h0j9eppS7V0hiYkJtn5LdxKWZMs1OTZsksqqAUd HHElEI5syTn4WPidXBAAd0TA/sVOJGbUxFjrSToE6f/xHFX8w+AMDMma5OfZmPRoM4YA XITQjhBpyhsrg1/J93BCrvVJi7DApJQKxm/YCXR+UB5rMpkYKAeRffjX8qlmzNL5Lfwa JoZw== X-Gm-Message-State: ALoCoQnipx+flYJo4LpjH4Yy4PyZof+fPwU3DHQTfQ7XSffJrFU+rSLzbTn6gjUSyacoFCQoWdce X-Received: by 10.112.55.104 with SMTP id r8mr2398952lbp.18.1431595326263; Thu, 14 May 2015 02:22:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.197 with SMTP id o5ls352830laf.66.gmail; Thu, 14 May 2015 02:22:06 -0700 (PDT) X-Received: by 10.112.188.194 with SMTP id gc2mr2417126lbc.25.1431595326069; Thu, 14 May 2015 02:22:06 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id g2si14099888laa.128.2015.05.14.02.22.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 May 2015 02:22:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lagv1 with SMTP id v1so58864060lag.3 for ; Thu, 14 May 2015 02:22:06 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr2490211lbh.56.1431595325921; Thu, 14 May 2015 02:22:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1112569lbb; Thu, 14 May 2015 02:22:05 -0700 (PDT) X-Received: by 10.55.33.40 with SMTP id h40mr6633605qkh.69.1431595324517; Thu, 14 May 2015 02:22:04 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o100si1016406qge.30.2015.05.14.02.22.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 14 May 2015 02:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:53237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspL9-0000Cg-H3 for patch@linaro.org; Thu, 14 May 2015 05:22:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspKP-00084R-Ba for qemu-devel@nongnu.org; Thu, 14 May 2015 05:21:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YspKL-0004Sq-Bp for qemu-devel@nongnu.org; Thu, 14 May 2015 05:21:17 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:33029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspKK-0004Jy-Ly for qemu-devel@nongnu.org; Thu, 14 May 2015 05:21:13 -0400 Received: from 172.24.2.119 (EHLO szxeml430-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BGA58875; Thu, 14 May 2015 17:20:55 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.158.1; Thu, 14 May 2015 17:20:46 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 14 May 2015 17:19:20 +0800 Message-ID: <1431595182-7552-2-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1431595182-7552-1-git-send-email-zhaoshenglong@huawei.com> References: <1431595182-7552-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.555468F7.0159, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ef88aeab93d1417749dab6b325b89cd1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v7 01/23] hw/arm/virt: Move common definitions to virt.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao Move some common definitions to virt.h. These will be used by generating ACPI tables. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/arm/virt.c | 21 +------------------ include/hw/arm/virt.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 20 deletions(-) create mode 100644 include/hw/arm/virt.h diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a7f9a10..8959d0c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -31,6 +31,7 @@ #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" +#include "hw/arm/virt.h" #include "hw/devices.h" #include "net/net.h" #include "sysemu/block-backend.h" @@ -44,8 +45,6 @@ #include "qemu/error-report.h" #include "hw/pci-host/gpex.h" -#define NUM_VIRTIO_TRANSPORTS 32 - /* Number of external interrupt lines to configure the GIC with */ #define NUM_IRQS 128 @@ -60,24 +59,6 @@ #define GIC_FDT_IRQ_PPI_CPU_START 8 #define GIC_FDT_IRQ_PPI_CPU_WIDTH 8 -enum { - VIRT_FLASH, - VIRT_MEM, - VIRT_CPUPERIPHS, - VIRT_GIC_DIST, - VIRT_GIC_CPU, - VIRT_UART, - VIRT_MMIO, - VIRT_RTC, - VIRT_FW_CFG, - VIRT_PCIE, -}; - -typedef struct MemMapEntry { - hwaddr base; - hwaddr size; -} MemMapEntry; - typedef struct VirtBoardInfo { struct arm_boot_info bootinfo; const char *cpu_model; diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h new file mode 100644 index 0000000..2fe0d2e --- /dev/null +++ b/include/hw/arm/virt.h @@ -0,0 +1,56 @@ +/* + * + * Copyright (c) 2015 Linaro Limited + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + * + * Emulate a virtual board which works by passing Linux all the information + * it needs about what devices are present via the device tree. + * There are some restrictions about what we can do here: + * + we can only present devices whose Linux drivers will work based + * purely on the device tree with no platform data at all + * + we want to present a very stripped-down minimalist platform, + * both because this reduces the security attack surface from the guest + * and also because it reduces our exposure to being broken when + * the kernel updates its device tree bindings and requires further + * information in a device binding that we aren't providing. + * This is essentially the same approach kvmtool uses. + */ + +#ifndef QEMU_ARM_VIRT_H +#define QEMU_ARM_VIRT_H + +#include "qemu-common.h" + +#define NUM_VIRTIO_TRANSPORTS 32 + +enum { + VIRT_FLASH, + VIRT_MEM, + VIRT_CPUPERIPHS, + VIRT_GIC_DIST, + VIRT_GIC_CPU, + VIRT_UART, + VIRT_MMIO, + VIRT_RTC, + VIRT_FW_CFG, + VIRT_PCIE, +}; + +typedef struct MemMapEntry { + hwaddr base; + hwaddr size; +} MemMapEntry; + + +#endif