From patchwork Thu Sep 27 06:50:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 10617315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CC8714BD for ; Thu, 27 Sep 2018 06:51:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EA532AFD3 for ; Thu, 27 Sep 2018 06:51:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02AF52B03F; Thu, 27 Sep 2018 06:51:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A0AD82AFD4 for ; Thu, 27 Sep 2018 06:51:36 +0000 (UTC) Received: from localhost ([::1]:33993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Q9A-0007I2-0U for patchwork-qemu-devel@patchwork.kernel.org; Thu, 27 Sep 2018 02:51:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5Q81-0006Pk-27 for qemu-devel@nongnu.org; Thu, 27 Sep 2018 02:50:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5Q80-0007KW-AU for qemu-devel@nongnu.org; Thu, 27 Sep 2018 02:50:24 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:37671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5Q80-0007K9-4C; Thu, 27 Sep 2018 02:50:24 -0400 Received: by mail-pf1-x441.google.com with SMTP id x26-v6so1175503pfn.4; Wed, 26 Sep 2018 23:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kcTuBNpogtj/a4qjZ/jT3yyOjdVaDjQqOrcRP5ONbSU=; b=I1We6phhFEpAnHT1X7U252UYIV1ju0XZFs8EFVmyNd2eD4ogrxalrgCbdPMJytY4yw PXVky0kDMLvwA92QIv4NugaYB34rRsZHN0vET568zMwcrpeRe3mbr3Q6FQEAuT8Z/D/1 Y4uQuGYMrPl0HS283qpxhc5bWrZ+Qx75AA4HZZj0NPQHYJ3e1zVoBfYhf5wCNLQfc3l7 yyt0pTxumzAFxa5J1C2XwbGKZubOZJZgDNhEtA+OdpWw8rU0tjlyKhOJASpsLyLmLm33 wpvmZUSRTIqB3TRt3lncVAxK8l3ZANe1/7L4RRsQflO9bm9NTcA9+mCw+5RlwmWEiZDS SDAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kcTuBNpogtj/a4qjZ/jT3yyOjdVaDjQqOrcRP5ONbSU=; b=TgWUePTI1aEg4mp0Vy6+cwcluScK6c8/HzYNPsXLty9MtinzZNCYds+4vNHxqejRt3 7kU36lniKZvCePEuTfXktQntID1y/8tZbeki53AhQCiti7Cm//xrCfpV+wXFsIb59Ty3 U8A48d18fpvTxomnI4NorxoS84mjAwS0zV0pjGDY7xUFuS7US7j5H2PtopE5zJ3PvGIE 7kpcj5MaARbqZ/t3m8133Mrlot87ABuizwgOHf8BLYYkDsMpjoC8znbBAR+vq424P4tI 2yU0dpuwZ0HD9WgHMEeWcZNBBFaH963LCcnPqfze9rZUpBybeQR0hPjQtKJ5ZHcOXIOi h8Mw== X-Gm-Message-State: ABuFfoilkVz/2QEcSobQspiEPl56bIzVCiVmxx/PVnnjedZRc8CBdNi8 YU2kpsbAZj+Of+AMaUa6N9Q= X-Google-Smtp-Source: ACcGV60g/MFJNboWFr+VOgg5ZDi0qA+U2/myfH4uBTHvpcBPAP8yOGnsipkhhoj2jkL4gVfrlz+nLA== X-Received: by 2002:a17:902:bcc3:: with SMTP id o3-v6mr9505568pls.202.1538031023244; Wed, 26 Sep 2018 23:50:23 -0700 (PDT) Received: from surajjs2.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id d18-v6sm1412561pfk.163.2018.09.26.23.50.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 23:50:22 -0700 (PDT) From: Suraj Jitindar Singh To: david@gibson.dropbear.id.au Date: Thu, 27 Sep 2018 16:50:08 +1000 Message-Id: <20180927065009.32154-2-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180927065009.32154-1-sjitindarsingh@gmail.com> References: <20180927065009.32154-1-sjitindarsingh@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::441 Subject: [Qemu-devel] [QEMU-PPC] [RFC 1/2] target/ppc: Add one reg id for ptcr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: paulus@ozlabs.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, sjitindarsingh@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The ptcr (partition table control register) is used to store the address and size of the partition table. For nested kvm-hv we have a level 1 guest register the location of it's partition table with the hypervisor. Thus to support migration we need to be able to read this out of kvm and restore it post migration. Add the one reg id for the ptcr. Signed-off-by: Suraj Jitindar Singh --- linux-headers/asm-powerpc/kvm.h | 1 + target/ppc/translate_init.inc.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kvm.h index 1b32b56a03..8c876c166e 100644 --- a/linux-headers/asm-powerpc/kvm.h +++ b/linux-headers/asm-powerpc/kvm.h @@ -634,6 +634,7 @@ struct kvm_ppc_cpu_char { #define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe) #define KVM_REG_PPC_ONLINE (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xbf) +#define KVM_REG_PPC_PTCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc0) /* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index 263e63cb03..487196800b 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8197,11 +8197,11 @@ static void gen_spr_power9_mmu(CPUPPCState *env) { #if !defined(CONFIG_USER_ONLY) /* Partition Table Control */ - spr_register_hv(env, SPR_PTCR, "PTCR", - SPR_NOACCESS, SPR_NOACCESS, - SPR_NOACCESS, SPR_NOACCESS, - &spr_read_generic, &spr_write_ptcr, - 0x00000000); + spr_register_kvm_hv(env, SPR_PTCR, "PTCR", + SPR_NOACCESS, SPR_NOACCESS, + SPR_NOACCESS, SPR_NOACCESS, + &spr_read_generic, &spr_write_ptcr, + KVM_REG_PPC_PTCR, 0x00000000); #endif }