From nobody Fri Nov 14 15:21:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1588586885; cv=none; d=zohomail.com; s=zohoarc; b=FVzUIagHm02Yph2xOhjBX+gaBMIbXKeUkKDzpuq+Y7IdzpTijt8jgcXuQtA6HbsR1jIr+pCI1CR5cL6/QYYzmvzrSt/jrvoO/+IO57q/0DvaD9wXPYFGv7OnA6DOXpuDG3fPDLFChth2Q+QWPgejDKJebBDQ/kvbaG1PhAk3bII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588586885; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pqAO0bA1QvbNiBti+VeepWcwOaVLpxEZnxKr37xmzuE=; b=BEJnppdZEnlBClRNqDFfF7QydvmG54kAreVsG+JATWnahgjJO4w7zf/alvQmt9y/Ts9OUO4/czNcD6YR0k+vXU2GPhmQEVXzcvBMpz7DgPv+XJMP+9Fu0ljt9KSp3cHQ0x6yBZCLFQlUwjMclwMtwUqqZCRfbbN+20C0W3C6m/U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1588586885069102.21428464506971; Mon, 4 May 2020 03:08:05 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jVY0n-0001t4-Ql; Mon, 04 May 2020 10:07:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jVY0m-0001sw-KV for xen-devel@lists.xenproject.org; Mon, 04 May 2020 10:07:44 +0000 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 16da9592-8def-11ea-b9cf-bc764e2007e4; Mon, 04 May 2020 10:07:41 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id y3so1167475wrt.1 for ; Mon, 04 May 2020 03:07:41 -0700 (PDT) Received: from x1w.redhat.com (26.red-88-21-207.staticip.rima-tde.net. [88.21.207.26]) by smtp.gmail.com with ESMTPSA id k9sm18517778wrd.17.2020.05.04.03.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 03:07:39 -0700 (PDT) X-Inumbo-ID: 16da9592-8def-11ea-b9cf-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pqAO0bA1QvbNiBti+VeepWcwOaVLpxEZnxKr37xmzuE=; b=mNzUhqyuvwbObBrckIQQRqTzNHBBsL3ym2fUD3m/+zm9Xqm7CM2aUjGEy0tWaFQrrD YVDAjI8z6v9lLJx42ToBPknDZfH05+UKtCzKzgNr4MTMkCfIk/m3I+6VTw+a3ljwYwDX vqw6SrYla+n8Fc7zIMhcGqQDjESGwm5u1EuKEWljsNLyKjNuANONlXznl4FYJ2xVrp40 VW0Oy0lzxZ/OSSeB5OKPMnQxWOlMkuv984lpi+FuBa6VtbIb57yelQpHA/eX75x4Zd5t tYxJobeQgsnQgUS/GWXUbL6lTDYSgG2TenM1Q/dfLoGVkes9QJ1ghKgcevtFXHzQM8bp J78Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pqAO0bA1QvbNiBti+VeepWcwOaVLpxEZnxKr37xmzuE=; b=Zbkrpwvg0oVp2gpMibD1sKPZPCnc+GCFqa2jYegO+8YAKvQbMjJe9UnIUtLw6iKfko rZIBl1p/QmY7HRlyGUbELULC22cCWU0ZwciKi0HgHssz1LOPy2M08cxh+bktCdlvBtcz IxfS+oRGBcPuOdjRElS38dtuRKH+Gsyc8S7uElN2izYzvzExlKP6Auw1sSBVd71dipiu CgMhUZMHVIv1AxLIX79X75gqa+qYDHal8ngP2OjF1VhyCVEuGokyonMEL5l/t1oOT3b+ F4IRczcsL2Xl11zYK7AAp24acXdqYPkgZNhZisey+/f6/FcEthT11Cc4tRWM/RLSvnYM SCEw== X-Gm-Message-State: AGi0PuauBYym6dCU5UJhhY/H9ndwdmpvBDa3YRlSIPvZfW6MWIjho5pc irVG82WK/HlLxkzfmJGiBsA= X-Google-Smtp-Source: APiQypLq5H1B+qwCkRrljK1N7qAw8SaQFKARSpmFekNGsBBZxyVnzr6zXEYdT7BPPkaenEkB9e3G3w== X-Received: by 2002:adf:eacb:: with SMTP id o11mr10572540wrn.253.1588586860549; Mon, 04 May 2020 03:07:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 1/3] target: Remove unnecessary CPU() cast Date: Mon, 4 May 2020 12:07:33 +0200 Message-Id: <20200504100735.10269-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200504100735.10269-1-f4bug@amsat.org> References: <20200504100735.10269-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Paul Durrant , Jason Wang , Mark Cave-Ayland , BALATON Zoltan , Gerd Hoffmann , "Edgar E. Iglesias" , Stefano Stabellini , qemu-block@nongnu.org, David Hildenbrand , Markus Armbruster , Halil Pasic , Christian Borntraeger , Aleksandar Markovic , Joel Stanley , Anthony Perard , xen-devel@lists.xenproject.org, Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Corey Minyard , Richard Henderson , "Dr. David Alan Gilbert" , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Peter Chubb , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Snow , David Gibson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Andrew Jeffery , Cornelia Huck , Laurent Vivier , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The CPU() macro is defined as: #define CPU(obj) ((CPUState *)(obj)) which expands to: ((CPUState *)object_dynamic_cast_assert((Object *)(obj), (name), __FILE__, __LINE__, __func__)) This assertion can only fail when @obj points to something other than its stated type, i.e. when we're in undefined behavior country. Remove the unnecessary CPU() casts when we already know the pointer is of CPUState type. Patch created mechanically using spatch with this script: @@ typedef CPUState; CPUState *s; @@ - CPU(s) + s Acked-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Markus Armbruster --- v2: Reword (Markus) --- target/ppc/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index 86c667b094..8972714775 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -1820,7 +1820,7 @@ static inline void do_invalidate_BAT(CPUPPCState *env= , target_ulong BATu, if (((end - base) >> TARGET_PAGE_BITS) > 1024) { /* Flushing 1024 4K pages is slower than a complete flush */ LOG_BATS("Flush all BATs\n"); - tlb_flush(CPU(cs)); + tlb_flush(cs); LOG_BATS("Flush done\n"); return; } --=20 2.21.3