Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4534055pxb; Tue, 5 Oct 2021 05:17:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrS+rCBHPRrM4n5owm1ZuhUWFLtrk4UG+fdMPySrHdsCQbwJgtL57t7ILgmHtjO5L5LHdO X-Received: by 2002:a17:902:e78f:b0:13d:f99f:34bb with SMTP id cp15-20020a170902e78f00b0013df99f34bbmr4944552plb.48.1633436240580; Tue, 05 Oct 2021 05:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633436240; cv=none; d=google.com; s=arc-20160816; b=iu3b796qOuTBTAserBH25s/xMjWi0QsDn7jtWNDvU3I0sbqZhC2YyJEPD5399yXniA lMVdjl8SFbfzuYbd/H0/MPD30rBaA9t2sRtuQhwpStZ1nW5QaWw2MBQBUXTaq2t8m1mU 1e/0Gie+PlHbYJVdCqADL/D+jBZzNI39XyDe7OVii9RUhO6FAHXrQEx5tfCAhcEXmTSN oSSmShGP6VJgYcgI9O8Ot8ONO4vFEEtnLrVcCDVdlbpoO0DPrmgR6281iOvlTrvVkwOc Zyw8fCybmhPi+qd5U8NReoJlFbXeSG6RVtoZPCfN7AQgQFVz/ipDukLXLShxz6uGjjpA m8RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=m/50e74I6mK0ds4X9rX72a/33EthQOH3jN2qPda+wXk=; b=zgdygJIAiY9K7U0c1JS+Eio+MJbjHFoL2I6HK/Pna+xCIDCk1fF9POsaC8mLyO/BTK 9uZVuAgihZPMpgSGbR5NX0naCY9Uvl4WlFAj+S17prVVoVeZhvWCy4NV14W8ZMz7Ec+C lT2LNC0bmh6onBFYhb+ym5NaDq4Wd5EqMatK2D8WNmygyXfxHlsBQ28PF/jvviBfYIMy vOcEs9jf3owHTDe2R9pHHlwId9r08EEeQxd7kpbuMjxdjsfbOrcNuLtgJG74WSwHBcO4 Z6Fgpi9jA+aDch6627gBQIGD7AFrVvcWv8u1laY4RUISQcy/2wCxYJufoN8k8Wx7vSo8 McEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="WhIY/ADU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si2080869pjr.32.2021.10.05.05.17.07; Tue, 05 Oct 2021 05:17:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="WhIY/ADU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233941AbhJEMSH (ORCPT + 99 others); Tue, 5 Oct 2021 08:18:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20463 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233672AbhJEMSG (ORCPT ); Tue, 5 Oct 2021 08:18:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633436176; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m/50e74I6mK0ds4X9rX72a/33EthQOH3jN2qPda+wXk=; b=WhIY/ADUaAxjlpq6UbqCLTBis1bEuupekqkuieq++DcAJthI1VQjizdvC44zHWOVgGeZ+s LHUEsyHmOOCiDZMdy2XFhvi9oHJRgbfprtbjl/PBQftdpcafx99ZICankCPU+S8yV3kflp 2Qjdd5P2ErkHr8jLvR+ZICJEggRh0HQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-B14qeA0YO_ehUZiZU6OrOQ-1; Tue, 05 Oct 2021 08:16:15 -0400 X-MC-Unique: B14qeA0YO_ehUZiZU6OrOQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC5411006AA2; Tue, 5 Oct 2021 12:16:12 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.193.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id E602A1F6; Tue, 5 Oct 2021 12:15:44 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: David Hildenbrand , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , "Michael S. Tsirkin" , Jason Wang , Dave Young , Baoquan He , Vivek Goyal , Michal Hocko , Oscar Salvador , Mike Rapoport , "Rafael J. Wysocki" , x86@kernel.org, xen-devel@lists.xenproject.org, virtualization@lists.linux-foundation.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 2/9] x86/xen: simplify xen_oldmem_pfn_is_ram() Date: Tue, 5 Oct 2021 14:14:23 +0200 Message-Id: <20211005121430.30136-3-david@redhat.com> In-Reply-To: <20211005121430.30136-1-david@redhat.com> References: <20211005121430.30136-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let's simplify return handling. Signed-off-by: David Hildenbrand --- arch/x86/xen/mmu_hvm.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/arch/x86/xen/mmu_hvm.c b/arch/x86/xen/mmu_hvm.c index b242d1f4b426..d1b38c77352b 100644 --- a/arch/x86/xen/mmu_hvm.c +++ b/arch/x86/xen/mmu_hvm.c @@ -21,23 +21,10 @@ static int xen_oldmem_pfn_is_ram(unsigned long pfn) .domid = DOMID_SELF, .pfn = pfn, }; - int ram; if (HYPERVISOR_hvm_op(HVMOP_get_mem_type, &a)) return -ENXIO; - - switch (a.mem_type) { - case HVMMEM_mmio_dm: - ram = 0; - break; - case HVMMEM_ram_rw: - case HVMMEM_ram_ro: - default: - ram = 1; - break; - } - - return ram; + return a.mem_type != HVMMEM_mmio_dm; } #endif -- 2.31.1