Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1100311rwb; Thu, 8 Dec 2022 06:48:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf59sHAtfLquUEuy3VwdSC+6wKR0OSpDPTki0UP43oFjzwC4mqyJAHCJPtoediM79wwT5RqH X-Received: by 2002:a17:906:70c2:b0:7ae:d58e:3a4a with SMTP id g2-20020a17090670c200b007aed58e3a4amr64021193ejk.332.1670510886966; Thu, 08 Dec 2022 06:48:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670510886; cv=pass; d=google.com; s=arc-20160816; b=oqeAuuC5lnFYCkUGauKa7JfA2K7E0RIx1M0zSTbXR0z2cpjqw0VA1GJJJ9bRjrc6Vt YJXB5jFO3bi1JHKM/u68/SH6L8OgnQ1NjX/s+6MB0hqdLsttSvSWS8LG60F2N4ZXjqOA rtIxleOYMa4nHKIeUVodZZqRKTLf+zBf4mC+NFvAAkJOFK7jZcWXw0n7zY24oUFEKCto /BTwO7gkj8dkyeVcSRaDSCi+RuzaOxU2Uf4QsN8hXCMVw1Gc5cFqlg9crzXyzCBF2UTg whYlbn4J1gNeNN8hLdrekn7QsxDLIRs1jca9hjeBSoSXeV813OoKcy8qXTqsDHTEV11v w/Ww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=f/MwRza61a3aYGrs7xvEym8Del1jpd2ovf54JzatWHI=; b=GF2Y/eGdCK43EWF/WnZEQ0gPad2pqxy5bSK86vAL9N5YFFjrbz3YQM8r4a1btSYvBq GaixuxrOXp9/PmhW1aQ3xtg5SWM+DDjzsUMaHcnjbsyEsSUKNCoThBWGm0a8/hpde9qs 68M2QHAV2DD/FdT6XPEezY+ypy5PLpen5XZPM49mVmwW/n4btLEYUjGV+FHMSc/NsZDD /0oHqNIvw5cX5LztrWirEvsOYNJj8plifheCh+qnM13ISnLiWNyz67yGvxy+1N3F/brS EEx2frv1rfmYq7NFtQDEmLCcn8lw8tpVwQq703Gv7sUvniKQG3/PfCNsToA5Ch20VdRw 1Rtw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=qojzHI3z; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a056402281300b00463cd7d6e7asi8707392ede.30.2022.12.08.06.47.48; Thu, 08 Dec 2022 06:48:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=qojzHI3z; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbiLHOhY (ORCPT + 72 others); Thu, 8 Dec 2022 09:37:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229896AbiLHOhU (ORCPT ); Thu, 8 Dec 2022 09:37:20 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2047.outbound.protection.outlook.com [40.107.244.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D945694906; Thu, 8 Dec 2022 06:37:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=InoQtMMLFGxSNLgFHoVpPics7uV9eZMCS8/JPYQr95+RZPHTmW7SgU9tOEJcH/5frkrRG1NLbBai7oppPI0W3AI14qvXC9TwVGhB4PnJSv9sw8AAJKpZgbWb8aanw14jyr/p/4YlK5QhZb21I6OMhbj/jb3x257u51Be/1Znrlyvi9l+YoTVEx8Kiv5fZNFbO7c+xHql6H4TNKEYF42D/kLtKgO8TRK1vtWxPcjDBy1zDAYukTyXAgQG2Wa0o2RO+v6aou6NbHlrXL7Gs4HsgJoLMVoibDylFLjGkfnrRRqmWgzCO3b0rs9F0QRVWT5P78ekISgRd1wzghCAUEoXsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f/MwRza61a3aYGrs7xvEym8Del1jpd2ovf54JzatWHI=; b=a191Sup/fFoPUE5Q4JjpdYNf8ebiFB9s2sfRSh5pPIZXQx4rBK/IjWiuSBdkCsznvj+sUsn548jUbbeAL6WHzWnLTfYy3X40WQxS3xHkLMxbyf6cgmxqy9GaEbcpy5GpW/5PH/2TB7g21G7vXBgJm2tTtXGrLWSpwQJbAR4Z/2ua0IzFyKUb+e5s0OXEXOE4KgAvlaeV+TYZJGgFtvBaJzbr+HBT1lhNJkq9BMoa0RHys7fJj6KC0V0YDDjiDzGxO/VJuigyxaeaiKxENDl5jF76mo9fHFoMqSI8MS3bqyNpY9ChhFkqsm0hhfpiocxeppnj89PJnkkRbA3+LsHt7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f/MwRza61a3aYGrs7xvEym8Del1jpd2ovf54JzatWHI=; b=qojzHI3zR3KlELSc+o+5gYkAMRjfbWu77xjcZvYwB6YtsAHsSIKGP7Ref4h8P9Obn9fvKGtDrcPEfGPfxCP1YbhdRBjkCigC2p7JaBMVS4ixDpGpWh4njyabwu0xTlC8B+Wq2hJ2zg+tHZhC1GuaPSL9KMVWT2YVT1oBXVhlDH4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB2810.namprd12.prod.outlook.com (2603:10b6:5:41::21) by DM4PR12MB5118.namprd12.prod.outlook.com (2603:10b6:5:391::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.16; Thu, 8 Dec 2022 14:37:17 +0000 Received: from DM6PR12MB2810.namprd12.prod.outlook.com ([fe80::8f76:f869:2e1f:331e]) by DM6PR12MB2810.namprd12.prod.outlook.com ([fe80::8f76:f869:2e1f:331e%6]) with mapi id 15.20.5880.014; Thu, 8 Dec 2022 14:37:17 +0000 Message-ID: Date: Thu, 8 Dec 2022 15:36:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [RFC PATCH V2 16/18] x86/sev: Initialize #HV doorbell and handle interrupt requests Content-Language: en-US To: Tianyu Lan , luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, seanjc@google.com, pbonzini@redhat.com, jgross@suse.com, tiala@microsoft.com, kirill@shutemov.name, jiangshan.ljs@antgroup.com, peterz@infradead.org, ashish.kalra@amd.com, srutherford@google.com, akpm@linux-foundation.org, anshuman.khandual@arm.com, pawan.kumar.gupta@linux.intel.com, adrian.hunter@intel.com, daniel.sneddon@linux.intel.com, alexander.shishkin@linux.intel.com, sandipan.das@amd.com, ray.huang@amd.com, brijesh.singh@amd.com, michael.roth@amd.com, thomas.lendacky@amd.com, venu.busireddy@oracle.com, sterritt@google.com, tony.luck@intel.com, samitolvanen@google.com, fenghua.yu@intel.com Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arch@vger.kernel.org References: <20221119034633.1728632-1-ltykernel@gmail.com> <20221119034633.1728632-17-ltykernel@gmail.com> From: "Gupta, Pankaj" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: PN3PR01CA0081.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:9a::20) To DM6PR12MB2810.namprd12.prod.outlook.com (2603:10b6:5:41::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB2810:EE_|DM4PR12MB5118:EE_ X-MS-Office365-Filtering-Correlation-Id: 0bd51f2f-33e5-4bcc-bb71-08dad929b445 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6S2zRqcjXAhEOotLk7Hpcknv9+39eFMgW6i3Gp7tGZ7/rvtt85c5FYrHWLmQCULu2v8UxMTTbSAtPknIYgKT0gqzwbOO7i5nIYuMOLUh/CVLzSJ1yQtzylGLcVek7XhrAsvVu0t4KiUtdFB+QJ1ZocDK6hfkDA7hAv0XdZ+wng9/sN3yFBBaEpY8CIZj0beax2e/KFgZDr9gs0WxJQN67GzCAJAjZl9VpFvMg39L26RuGWL+/zNkSFI7Upsv6vunwNHYgPqEk2f28b/9mnNXYMr0O3aAaHwaSZuD9Yd7cK1BXiq+xZF7uUkDfoYp3+JmKPaJnZ4NH8GdBwSBqsIpzXYcMGqEA8nKYzTLsDXXqK65ZF5f1ID860PEYLAlHLr4MACwf3GCzuEpuUyBbo1lZPzUckw/jgxYfaEzdZbC/zuKthW/E7fLjAic1a+EcTGlOMOwMP+qu2vY6b4UJam96aHhFFiPd1rGJRWxW0rzhihkvbPBaRv3wLjTXJoFgyq8SgJWMyvqCEE490Y/NR0JhJZBFBkCPNaE85oOv3DJh/W4jrP/DHISUweZEg+VWeQPkbNDCQVThNEvUA0ZTv+1WaAdjreN5L/oFZZKWSv/TTwwD6hK4LNiOrDWZ7Wu0NMcABERUuU0UbWFCqz2v46VgYlAOFkbFg7rFh6xiw7IkZIaRJWVxcKwWx6MGDmcuBIcokzr1tUyjU/wsGM1ZDrlLGXzEPhMsXMTw45IORxvjf8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB2810.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(346002)(376002)(366004)(136003)(451199015)(86362001)(31696002)(36756003)(6666004)(2906002)(6486002)(478600001)(4744005)(6512007)(53546011)(6506007)(186003)(26005)(66476007)(4326008)(8676002)(66556008)(66946007)(316002)(8936002)(7406005)(7416002)(5660300002)(41300700001)(38100700002)(921005)(2616005)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SVp0ak5mNzJNUDNSNmNmdmxqRlJTVHozNXgxU3U0MVRuR2I1NjBBYjlVcFhZ?= =?utf-8?B?YzBDa1JYUWg5dmF3eWM0ZWZoNDI2ZnNIY2ZqZTBneVhSWStDVklZS3d1d3Vy?= =?utf-8?B?TitxNjQrSUJDWUgrNjk2Ky9pREx1NllLc2Q5aDVNRUYvdDlHNHBWT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Q2tGbDVpUGFSM2N0Zi9SSDE5dGoxOUVxZEV4VUhP?= =?utf-8?B?SUtUdDZvcWorWTZDK3ZGTk9jUUJ2U09Sd2hFSDJPVFV3QTk1dllWb2pvK2tM?= =?utf-8?B?S1JJVlNFakMyM2gyMmZRY0t3YktsUGFLdVRRcmRTOVF2bjM1bUEyZHM0SC9N?= =?utf-8?Q?sOeQjtOi1orYE1YwywRrS7lci?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bd51f2f-33e5-4bcc-bb71-08dad929b445 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB2810.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2022 14:37:17.1920 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Nxe6iiH3VC8sj+5fZezymMPqOuWbFII1U8tJfHXbdorwBBCMbCz+Y4beHk4IdsR8xa8dNWhEoG1vHDHrF0/bGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5118 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/8/2022 3:21 PM, Tianyu Lan wrote: > On 12/7/2022 10:13 PM, Gupta, Pankaj wrote: >>> +#endif >>> +} >>> + >>>   static __always_inline void native_irq_disable(void) >>>   { >>>       asm volatile("cli": : :"memory"); >>> @@ -43,6 +59,9 @@ static __always_inline void native_irq_disable(void) >>>   static __always_inline void native_irq_enable(void) >>>   { >>>       asm volatile("sti": : :"memory"); >>> +#ifdef CONFIG_AMD_MEM_ENCRYPT >>> +    check_hv_pending(NULL); >> >> Just trying to understand when regs will be NULL? > > check_hv_pending() will be divided into two functions. > > The one handles #hv event in the #HV exception code path. > The other one handles pending irq event in the irq re-enable > code path。 In this version, the "regs = NULL" for check_hv_pending() > is used in the irq re-enable code path. Got it. Thanks, Pankaj