From patchwork Wed Jan 22 14:40:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11345853 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FEAA6C1 for ; Wed, 22 Jan 2020 14:41:48 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA39121835 for ; Wed, 22 Jan 2020 14:41:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA39121835 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuHBe-0000Fg-EU; Wed, 22 Jan 2020 14:40:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuHBd-0000FW-BG for xen-devel@lists.xenproject.org; Wed, 22 Jan 2020 14:40:53 +0000 X-Inumbo-ID: 2b5e0000-3d25-11ea-9fd7-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2b5e0000-3d25-11ea-9fd7-bc764e2007e4; Wed, 22 Jan 2020 14:40:44 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4C1B1B500; Wed, 22 Jan 2020 14:40:43 +0000 (UTC) To: "xen-devel@lists.xenproject.org" From: Jan Beulich Message-ID: Date: Wed, 22 Jan 2020 15:40:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 Content-Language: en-US Subject: [Xen-devel] [PATCH v2] x86/EPT: drop redundant ept_p2m_type_to_flags() parameters X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Wei Liu , George Dunlap , Andrew Cooper , Jun Nakajima , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" All callers set the respective fields in the entry being updated before the call. Take the opportunity and also constify the first parameter as well as make a few style adjustments. Signed-off-by: Jan Beulich Reviewed-by: Kevin Tian --- v2: Drop redundant function parameters instead. --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -61,8 +61,8 @@ static int atomic_write_ept_entry(struct return 0; } -static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry, - p2m_type_t type, p2m_access_t access) +static void ept_p2m_type_to_flags(const struct p2m_domain *p2m, + ept_entry_t *entry) { /* * First apply type permissions. @@ -75,7 +75,7 @@ static void ept_p2m_type_to_flags(struct * D bit is set for all writable types in EPT leaf entry, except for * log-dirty type with PML. */ - switch(type) + switch ( entry->sa_p2mt ) { case p2m_invalid: case p2m_mmio_dm: @@ -143,9 +143,8 @@ static void ept_p2m_type_to_flags(struct break; } - /* Then restrict with access permissions */ - switch (access) + switch ( entry->access ) { case p2m_access_n: case p2m_access_n2rwx: @@ -269,7 +268,7 @@ static bool_t ept_split_super_page(struc epte->snp = is_iommu_enabled(p2m->domain) && iommu_snoop; epte->suppress_ve = 1; - ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access); + ept_p2m_type_to_flags(p2m, epte); if ( (level - 1) == target ) continue; @@ -521,7 +520,7 @@ static int resolve_misconfig(struct p2m_ if ( nt != e.sa_p2mt ) { e.sa_p2mt = nt; - ept_p2m_type_to_flags(p2m, &e, e.sa_p2mt, e.access); + ept_p2m_type_to_flags(p2m, &e); } e.recalc = 0; wrc = atomic_write_ept_entry(p2m, &epte[i], e, level); @@ -574,7 +573,7 @@ static int resolve_misconfig(struct p2m_ e.ipat = ipat; e.recalc = 0; if ( recalc && p2m_is_changeable(e.sa_p2mt) ) - ept_p2m_type_to_flags(p2m, &e, e.sa_p2mt, e.access); + ept_p2m_type_to_flags(p2m, &e); wrc = atomic_write_ept_entry(p2m, &epte[i], e, level); ASSERT(wrc == 0); } @@ -789,7 +788,7 @@ ept_set_entry(struct p2m_domain *p2m, gf iommu_flags ) need_modify_vtd_table = 0; - ept_p2m_type_to_flags(p2m, &new_entry, p2mt, p2ma); + ept_p2m_type_to_flags(p2m, &new_entry); } if ( sve != -1 )