Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3334424iog; Mon, 27 Jun 2022 13:54:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vcbBvQuy3kGIPHayV6VWb6fKHz84AzluB38Y7ZJ77V02TbXZwK8XfjPLrNgrufWRCwS+p5 X-Received: by 2002:a17:907:7ea2:b0:726:c0e5:e997 with SMTP id qb34-20020a1709077ea200b00726c0e5e997mr2888694ejc.35.1656363254278; Mon, 27 Jun 2022 13:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656363254; cv=none; d=google.com; s=arc-20160816; b=Er5hattKmXK5PlgIw+lCkWW1tV7f/EMzcTnCYyE5iNy1g7q7fZufYJfmXg9pR/nxuQ W4tyHHFCA6KHL9UTGzz5kDxGLI8f1qQLLx3mGrWoxTza3BDwrhufzoSGjxo2aTGZ+Xn8 Z6cEykFrYmS5jecpZxAscAmTS+dBUA1E7O6jm1a72o03XA17CfvP/wIEsw5pljoq0Tlp XZQRM5UI5TLilzwaeZnLooqRTiBTeFnCFoS2QMTkvcaic9DKGReZDnZIQYOs9x1ksdVa SkS6+9Xpkb/CtB48XUXvE4yAp1cXC5gViKMzvCctJmKtCpJhPhaS4cLDJ8n/4Go6nmCc uXBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=I67M0XjSkDJ3GIxlgUdwOTJNfs2po6VfuNk3ciZIU2U=; b=bkkUDPf1q3wBG+hn05U/rHRFWrge1OnMIirwbih2Rr9DP/MOgE6cb2gE15jgIfD+XI yavWCuURHKiUnYB+z0BkN7M6/rsHjajd6d4Ww/1G4enKZHw4cmaBuuh8tn3Jr/GDNcAG O0nIFSoeJzHJoIdIZpl27LAw2+ll/9Zb7gAtioW8dQSqdVlAUQ9F7gmoEUrBaDxMpWAF QQp9aR4aBnL3yYS+QEx3qfNVuJElWwJ72rB9gsy9GzAX+7giXgxqxhXHyjHhsASj9kTe ID3UskajxjgmcLbJND1t+I7X951uEkdDM5ste21Z2T50hwkKDhx5hpuDu7u11iHdYXwd eXPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Th/QgnYU"; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a1709064f8800b006ff21848071si11852347eju.637.2022.06.27.13.53.41; Mon, 27 Jun 2022 13:54:14 -0700 (PDT) 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=@intel.com header.s=Intel header.b="Th/QgnYU"; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240582AbiF0Um1 (ORCPT + 99 others); Mon, 27 Jun 2022 16:42:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239191AbiF0Um0 (ORCPT ); Mon, 27 Jun 2022 16:42:26 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F07481EECD; Mon, 27 Jun 2022 13:42:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656362544; x=1687898544; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=teCkAY150hpKgnL1JJaIVCKfP+fzFobYu8LKDCwZNbM=; b=Th/QgnYUuHhNuyABbhvM5cmuYLVeUZHJYE31njpDaOq0D6j836+2nrWt 727CZotrw99WyOQ4P/hrZOar3ql2ArYoe8vax+2UIyP4107CmMY4RXlU5 8FnDJZeHxb3Lk4aXw7FiX/EymmhBjOnaMQP5AxoWoJ5NmLgwRfMTnnWYl fAVmeo/AqEgcxjUK2iLIt7pZxsw7i4uFPXipD05Zfx12tiWKdCTHg9Q3T xcM00NIsYCLyLjNsg+NZqkPJieM9MF1+U6QwtDs/CaWSZ8wAFqUg+cDnb gjbRmKwBjNOEFCu1cmb3EbQUgkThgvN/MYc3rqGEGk8LGZoQRg7VWKOzu A==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="261970165" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="261970165" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 13:42:23 -0700 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="732471886" Received: from jsagoe-mobl1.amr.corp.intel.com (HELO [10.209.12.66]) ([10.209.12.66]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 13:42:22 -0700 Message-ID: Date: Mon, 27 Jun 2022 13:41:24 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v5 15/22] x86/virt/tdx: Allocate and set up PAMTs for TDMRs Content-Language: en-US To: Kai Huang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: seanjc@google.com, pbonzini@redhat.com, len.brown@intel.com, tony.luck@intel.com, rafael.j.wysocki@intel.com, reinette.chatre@intel.com, dan.j.williams@intel.com, peterz@infradead.org, ak@linux.intel.com, kirill.shutemov@linux.intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, isaku.yamahata@intel.com References: From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 6/27/22 03:31, Kai Huang wrote: >>> +/* Page sizes supported by TDX */ >>> +enum tdx_page_sz { >>> + TDX_PG_4K, >>> + TDX_PG_2M, >>> + TDX_PG_1G, >>> + TDX_PG_MAX, >>> +}; >> Are these the same constants as the magic numbers in Kirill's >> try_accept_one()? > try_accept_once() uses 'enum pg_level' PG_LEVEL_{4K,2M,1G} directly. They can > be used directly too, but 'enum pg_level' has more than we need here: I meant this: + switch (level) { + case PG_LEVEL_4K: + page_size = 0; + break; Because TDX_PG_4K==page_size==0, and for this: + case PG_LEVEL_2M: + page_size = 1; where TDX_PG_2M==page_size==1 See? Are Kirill's magic 0/1/2 numbers the same as TDX_PG_4K, TDX_PG_2M, TDX_PG_1G, ?