Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1961210rwe; Fri, 2 Sep 2022 06:38:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR7vwbrEI+gVCBiqsqFO6VWCmJps0UaecFCEmOzyJ8Rd32ziB7amxZ8v2GaKpQYbOhIlFU8W X-Received: by 2002:a17:902:a704:b0:174:3ad5:30b8 with SMTP id w4-20020a170902a70400b001743ad530b8mr33957332plq.14.1662125927184; Fri, 02 Sep 2022 06:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662125927; cv=none; d=google.com; s=arc-20160816; b=hMc9tNRM2CkRc9rN48KD0hcByQ2z7vIt3UrMgd5H51jeyfkkfbbQgfDQoZ1/s62Yhp j8u6SEE/ahGldqY7WcWSq6ZYm+dV+hclVb7oJ6zzYExA3l0s2NM+IdnprcMeLeYH4w2Q Z0zzPk/v8KLpOBP0Wj1Fmnd+ad+235fuaWpXu0Mus93eiWQhvXD37okH0F+wCPjo/os3 L1LGsVaOH+5T6wAOTduD0/GkCjY4gWfczY02wm0pv/fHj99jE0Rbo1Wq/i0Oky7Nwso6 qnqbtbEKzpP1lHScTyHhptx3S17AHemVPItAPdnvZEnyEhaH1L4icoJpyMQU/u4gs4Ih M0tg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cBtZaPD40Kq6NldASEzLtzlZe9aW8IHrkRDf3K6M+ec=; b=eyzI3dfDGX45DDm+mP/RuZRolOMgYnb378Yxwunh79BHY0rM0CdGZJZDAc9fEY27jP OiE/P+iVcsA/lgC9QCCxcf1LMgO8RPXXouvQqX8Hc6iM3iNgqXtNLQYR0Q1BcIAn+amu +vOtqQmD6YAeIY6YrvvDK2778u8FQsRo0etSbJPx6emwgcHyQ3TSIzp5if5sqP+95uIC H3y+JqUqRND9OFP8b+6ZwSN0oToTHG4/GeWFfR2SlE1RLaWfDsvp31J4TffV77oeJHYa Stp6F9WHoHk5LuA5fCXTOU7eQn2wbsIyqvGUTWDIc+QoVH0iRWEKFArpZhv7x+Q+yQNB z0jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VCrD5gyN; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp19-20020a17090b191300b001fd81aebb48si7176928pjb.167.2022.09.02.06.38.31; Fri, 02 Sep 2022 06:38:47 -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=@linuxfoundation.org header.s=korg header.b=VCrD5gyN; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237870AbiIBMwp (ORCPT + 99 others); Fri, 2 Sep 2022 08:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237798AbiIBMvo (ORCPT ); Fri, 2 Sep 2022 08:51:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A2FAF2CA7; Fri, 2 Sep 2022 05:37:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0D973B82AC8; Fri, 2 Sep 2022 12:35:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36C00C433D6; Fri, 2 Sep 2022 12:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662122132; bh=/GzZFNJ4zbZE3yw3cxjtkbCmRfMDh5qUScV5IZLRNnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VCrD5gyNvfLAACkBLUlgbnHZYrtUxwUtXvnC4PdQZJ5PqaSiaJ8YTj9Njg7gjz5KE IjflNz3AgS57vhJya+fF6zpnIOJEM101k5e/kaY2Enn2RIV/kN8zc7DcIKd1d5MYRg BMNU/CgLgdQYx4/4ZQyi7BqYxSnBx/CI2ZrTgltM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Timo Alho , Mikko Perttunen , Thierry Reding , Jon Hunter Subject: [PATCH 5.19 03/72] firmware: tegra: bpmp: Do only aligned access to IPC memory area Date: Fri, 2 Sep 2022 14:18:39 +0200 Message-Id: <20220902121404.873205464@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121404.772492078@linuxfoundation.org> References: <20220902121404.772492078@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 From: Timo Alho commit a4740b148a04dc60e14fe6a1dfe216d3bae214fd upstream. Use memcpy_toio and memcpy_fromio variants of memcpy to guarantee no unaligned access to IPC memory area. This is to allow the IPC memory to be mapped as Device memory to further suppress speculative reads from happening within the 64 kB memory area above the IPC memory when 64 kB memory pages are used. Signed-off-by: Timo Alho Signed-off-by: Mikko Perttunen Signed-off-by: Thierry Reding Cc: Jon Hunter Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/tegra/bpmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/firmware/tegra/bpmp.c +++ b/drivers/firmware/tegra/bpmp.c @@ -201,7 +201,7 @@ static ssize_t __tegra_bpmp_channel_read int err; if (data && size > 0) - memcpy(data, channel->ib->data, size); + memcpy_fromio(data, channel->ib->data, size); err = tegra_bpmp_ack_response(channel); if (err < 0) @@ -245,7 +245,7 @@ static ssize_t __tegra_bpmp_channel_writ channel->ob->flags = flags; if (data && size > 0) - memcpy(channel->ob->data, data, size); + memcpy_toio(channel->ob->data, data, size); return tegra_bpmp_post_request(channel); } @@ -420,7 +420,7 @@ void tegra_bpmp_mrq_return(struct tegra_ channel->ob->code = code; if (data && size > 0) - memcpy(channel->ob->data, data, size); + memcpy_toio(channel->ob->data, data, size); err = tegra_bpmp_post_response(channel); if (WARN_ON(err < 0))