{"id":815194,"url":"http://patchwork.ozlabs.org/api/patches/815194/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170918215719.16415-1-f4bug@amsat.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170918215719.16415-1-f4bug@amsat.org>","list_archive_url":null,"date":"2017-09-18T21:57:19","name":"[RFC] vl.c: add is_system_on_chip flag to force board default cpu","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"9aa532069d968cc506da0304e40fe6c553db81d2","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/?format=json","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170918215719.16415-1-f4bug@amsat.org/mbox/","series":[{"id":3742,"url":"http://patchwork.ozlabs.org/api/series/3742/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3742","date":"2017-09-18T21:57:19","name":"[RFC] vl.c: add is_system_on_chip flag to force board default cpu","version":1,"mbox":"http://patchwork.ozlabs.org/series/3742/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815194/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815194/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"c1a3rCDt\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xx0HV102Zz9s7m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 07:57:58 +1000 (AEST)","from localhost ([::1]:39082 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1du43A-0002VO-9n\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 17:57:56 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:54704)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1du42q-0002VA-S9\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 17:57:37 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1du42m-0007qi-OE\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 17:57:36 -0400","from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:37390)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1du42m-0007qV-JZ\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 17:57:32 -0400","by mail-qk0-x241.google.com with SMTP id r66so1176452qke.4\n\tfor <qemu-devel@nongnu.org>; Mon, 18 Sep 2017 14:57:32 -0700 (PDT)","from yoga.offpageads.com ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tu52sm5873113qtb.34.2017.09.18.14.57.29\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 18 Sep 2017 14:57:31 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=F9gcL5Yze76hPXUcuIZs9mgBu8V4wnx2MmShHh+Y4W4=;\n\tb=c1a3rCDt+MJmPJnvMyWFZM1nigQPuNcylWrxvBlj3pnuBeqTEj/s31/BMV/qErQHvD\n\taNoK7zpjMUAmV30x1B+Ll9v5iH3CPFVYW5iFuy97h6YbM30m+/eYcNqFqlhhyTOwPJnO\n\tCH5BYV76FI0SPDA81Qyt8bAYXtNpXD17zW9VVRFj7Ft+QnsimlxwRGDwnEQkqnZky4Tg\n\t6lGvS9LTRHY8PXRyRrz5UhJ2Tr9mNuP+CpfBbdbgOFf62+J86x9MVtPcYtCl62d67vYc\n\tBp/5a4YY218tOUadyohViNrpBmmt+bcfBqSKSsTbo55kdvWtx1sIb1SBKNg09Y7LdQer\n\tf/zg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:mime-version:content-transfer-encoding;\n\tbh=F9gcL5Yze76hPXUcuIZs9mgBu8V4wnx2MmShHh+Y4W4=;\n\tb=tZCkiQc+Di1EMVki4t3p6yBIMKanMvENfx9YWRpWsemzkjYAWd5gL35n+mmmg5bwu2\n\tgDaA62AH+2G7AcQ3I4UkLhF5Cblzux3ePI/eVTAzbwD3m0FSgh8HGVEsiidhEThyQ2iN\n\tWy/rf+V0ooc8u36+1SGuzqgXNebtKOZVujTHAcwPOJKOAJ2DIEVOvdYmApVDyt2o+ctR\n\t0LwZPn9DB6acHfUXPu4stMaexFSyhNXp6i7MG3IXNY/NN2THjgZ/Xlj6Sn+WAoXBhtI/\n\tnkxINIEVzn1q0LL0CCm5D2iJ1LNPa3RFstNmZb/pMTplalUpFWSkVB/U2/jweHTFZh1F\n\tiOMA==","X-Gm-Message-State":"AHPjjUgPkaKM++LCnb7koEiT+WVmbxvceJo6YAuk6Ix3aeTndmDzurwQ\n\t68m1Tp9ZDxiwpQ==","X-Google-Smtp-Source":"AOwi7QB8tApkhifwgke3h8sh0cEv0JMElFYOxZJijGYp0jM19oaWq8iv0l5Fhl9OSG+iko3yVJpxZA==","X-Received":"by 10.55.212.129 with SMTP id s1mr22335331qks.63.1505771851918; \n\tMon, 18 Sep 2017 14:57:31 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","To":"Igor Mammedov <imammedo@redhat.com>,\n\tEduardo Habkost <ehabkost@redhat.com>, \n\tPaolo Bonzini <pbonzini@redhat.com>,\n\tPeter Maydell <peter.maydell@linaro.org>","Date":"Mon, 18 Sep 2017 18:57:19 -0300","Message-Id":"<20170918215719.16415-1-f4bug@amsat.org>","X-Mailer":"git-send-email 2.14.1","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c09::241","Subject":"[Qemu-devel] [RFC PATCH] vl.c: add is_system_on_chip flag to force\n\tboard default cpu","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>,\n\tqemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"add a property to restrict the CPU for SoCs once on machine creation and avoid\nduplicate code in each board.\n\nSigned-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n---\nBased-on: 1505318697-77161-6-git-send-email-imammedo@redhat.com\n\n include/hw/boards.h |  3 +++\n vl.c                | 11 +++++++++++\n 2 files changed, 14 insertions(+)","diff":"diff --git a/include/hw/boards.h b/include/hw/boards.h\nindex 6b67adaef6..20dc0a0ab9 100644\n--- a/include/hw/boards.h\n+++ b/include/hw/boards.h\n@@ -129,6 +129,8 @@ typedef struct {\n  *    specifies default CPU_TYPE, which will be used for parsing target\n  *    specific features and for creating CPUs if CPU name wasn't provided\n  *    explicitly at CLI\n+ * @is_system_on_chip:\n+ *    If true, board does not support other CPUs than default_cpu_type.\n  * @minimum_page_bits:\n  *    If non-zero, the board promises never to create a CPU with a page size\n  *    smaller than this, so QEMU can use a more efficient larger page\n@@ -182,6 +184,7 @@ struct MachineClass {\n     const char *hw_version;\n     ram_addr_t default_ram_size;\n     const char *default_cpu_type;\n+    bool is_system_on_chip;\n     bool option_rom_has_mr;\n     bool rom_file_has_mr;\n     int minimum_page_bits;\ndiff --git a/vl.c b/vl.c\nindex fb6a700e55..6e59ffa856 100644\n--- a/vl.c\n+++ b/vl.c\n@@ -4717,10 +4717,21 @@ int main(int argc, char **argv, char **envp)\n     current_machine->cpu_model = cpu_model;\n \n \n+    if (machine_class->is_system_on_chip && !machine_class->default_cpu_type) {\n+        error_report(\"System-on-Chip must have a default CPU type\");\n+        exit(1);\n+    }\n     /* parse features once if machine provides default cpu_type */\n     if (machine_class->default_cpu_type) {\n         current_machine->cpu_type = machine_class->default_cpu_type;\n         if (cpu_model) {\n+            if (machine_class->is_system_on_chip) {\n+                if (strcmp(cpu_model, machine_class->default_cpu_type) != 0) {\n+                    error_report(\"This board can only be used with CPU %s\",\n+                                 machine_class->default_cpu_type);\n+                    exit(1);\n+                }\n+            }\n             current_machine->cpu_type =\n                 cpu_parse_cpu_model(machine_class->default_cpu_type, cpu_model);\n         }\n","prefixes":["RFC"]}