devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Lee Jones <lee.jones@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Mark Rutland <mark.rutland@arm.com>,
	Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
	Jonathan Corbet <corbet@lwn.net>,
	Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	"Darrick J . Wong" <darrick.wong@oracle.com>,
	Eric Sandeen <sandeen@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	Wu Hao <hao.wu@intel.com>,
	Tomohiro Kusumi <kusumi.tomohiro@gmail.com>,
	"Bryant G . Ly" <bryantly@linux.vnet.ibm.com>,
	Frederic Barrat <fbarrat@linux.vnet.ibm.com>,
	"David S . Miller" <davem@davemloft.net>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Philippe Ombredanne <pombredanne@nexb.com>,
	Vinod Koul <vkoul@kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	David Kershner <david.kershner@unisys.com>,
	Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>,
	Sagar Dharia <sdharia@codeaurora.org>,
	Johan Hovold <johan@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Juergen Gross <jgross@suse.com>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	openbmc@lists.ozlabs.org, Gavin Schenk <g.schenk@eckelmann.de>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Cyrille Pitchen <cyrille.pitchen@free-electrons.com>,
	Alan Cox <alan@linux.intel.com>, Andrew Lunn <andrew@lunn.ch>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Jason M Biils <jason.m.bills@linux.intel.com>,
	Julia Cartwright <juliac@eso.teric.us>,
	Haiyue Wang <haiyue.wang@linux.intel.com>,
	James Feist <james.feist@linux.intel.com>,
	Vernon Mauery <vernon.mauery@linux.intel.com>
Subject: Re: [PATCH v10 03/12] peci: Add support for PECI bus driver core
Date: Fri, 25 Jan 2019 10:51:54 -0800	[thread overview]
Message-ID: <22d2e334-b792-1047-87fb-abce2ea87e2a@linux.intel.com> (raw)
In-Reply-To: <20190125071823.GC11891@kroah.com>

Hi Greg,

On 1/24/2019 11:18 PM, Greg Kroah-Hartman wrote:
> On Thu, Jan 24, 2019 at 02:01:10PM -0800, Jae Hyun Yoo wrote:
>> On 1/23/2019 10:57 PM, Greg Kroah-Hartman wrote:
>>> On Wed, Jan 23, 2019 at 01:38:24PM -0800, Jae Hyun Yoo wrote:
>>>>> What about the un-initialized fields in this structure?  Can you
>>>>> properly handle that, and also, is this ok to be on the stack?
>>>>
>>>> It's fully initialized at here because the peci_ping_msg struct has only
>>>> one member:
>>>>
>>>> struct peci_ping_msg {
>>>> 	__u8 addr;
>>>> };
>>>
>>> Ok.  But my question about "can you do this off the stack" remains.
>>
>> I'll add 3 bytes of dummy padding into this structure. Also, I'll check
>> again u32 boundary alignment for all struct defines in peci_ioctl.h.
>> Would it be okay to be on stack then?
> 
> The issue of being on the stack has nothing to do with alignment, and
> everything to do with, "can your controller handle data from the stack".
> Lots of busses and controllers can not (i.e. all USB devices), so you
> have to properly allocate all memory that is used for data transfers
> from areas that are able to do DMA properly (i.e. by using kmalloc).
> 
> That is why I asked here about that, if this is a USB driver, having the
> data you wish to send from a stack variable is not allowed.  I don't
> know how your hardware works, which is why I was asking this.
> 
> Note, some architectures (like x86), hide this fact as their stack
> memory is able to be DMA, so you do not run into any errors.  Other
> arches that Linux supports are not like that, which is why we have those
> types of restrictions.

Thanks for your detailed explanation.

In this core driver, all PECI command messages will be translated into
the raw PECI message structure (peci_xfer_msg) and it is the actual
data which will be delivered to an adapter driver through
adapter->xfer().

I'll fix the translation logic to use heap instead of stack for handling
the peci_xfer_msg structure.

Thanks,
Jae

  reply	other threads:[~2019-01-25 18:51 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07 21:41 [PATCH v10 00/12] PECI device driver introduction Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 01/12] dt-bindings: Add a document of PECI subsystem Jae Hyun Yoo
2019-01-14  5:34   ` Joel Stanley
2019-01-07 21:41 ` [PATCH v10 02/12] Documentation: ioctl: Add ioctl numbers for " Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 03/12] peci: Add support for PECI bus driver core Jae Hyun Yoo
2019-01-22 13:20   ` Greg Kroah-Hartman
2019-01-23 21:38     ` Jae Hyun Yoo
2019-01-24  6:57       ` Greg Kroah-Hartman
2019-01-24 22:01         ` Jae Hyun Yoo
2019-01-25  7:18           ` Greg Kroah-Hartman
2019-01-25 18:51             ` Jae Hyun Yoo [this message]
2019-01-26  8:29               ` Greg Kroah-Hartman
2019-01-28 17:25                 ` Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 04/12] dt-bindings: Add a document of PECI adapter driver for ASPEED AST24xx/25xx SoCs Jae Hyun Yoo
2019-01-14  5:37   ` Joel Stanley
2019-01-07 21:41 ` [PATCH v10 05/12] ARM: dts: aspeed: peci: Add PECI node Jae Hyun Yoo
2019-01-14  5:45   ` Joel Stanley
2019-01-14 22:12     ` Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 06/12] peci: Add a PECI adapter driver for Aspeed AST24xx/AST25xx Jae Hyun Yoo
2019-01-14 11:37   ` Joel Stanley
2019-01-14 22:49     ` Jae Hyun Yoo
2019-01-15 23:14       ` Joel Stanley
2019-01-15 23:36         ` Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 07/12] dt-bindings: mfd: Add a document for PECI client driver Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 08/12] mfd: intel-peci-client: Add " Jae Hyun Yoo
2019-01-14 11:42   ` Joel Stanley
2019-01-14 23:03     ` Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 09/12] Documentation: hwmon: Add documents for PECI hwmon client drivers Jae Hyun Yoo
2019-01-14 11:43   ` Joel Stanley
2019-01-14 22:54     ` Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 10/12] hwmon: Add PECI cputemp driver Jae Hyun Yoo
2019-01-09 12:57   ` Miguel Ojeda
2019-01-18 17:52     ` Jae Hyun Yoo
2019-01-18 19:05       ` Miguel Ojeda
2019-01-18 19:15         ` Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 11/12] hwmon: Add PECI dimmtemp driver Jae Hyun Yoo
2019-01-07 21:41 ` [PATCH v10 12/12] Add maintainers for the PECI subsystem Jae Hyun Yoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22d2e334-b792-1047-87fb-abce2ea87e2a@linux.intel.com \
    --to=jae.hyun.yoo@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=andrew@aj.id.au \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@intel.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=bryantly@linux.vnet.ibm.com \
    --cc=corbet@lwn.net \
    --cc=cyrille.pitchen@free-electrons.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=darrick.wong@oracle.com \
    --cc=davem@davemloft.net \
    --cc=david.kershner@unisys.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fbarrat@linux.vnet.ibm.com \
    --cc=fengguang.wu@intel.com \
    --cc=g.schenk@eckelmann.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=haiyue.wang@linux.intel.com \
    --cc=hao.wu@intel.com \
    --cc=james.feist@linux.intel.com \
    --cc=jason.m.bills@linux.intel.com \
    --cc=jdelvare@suse.com \
    --cc=jgross@suse.com \
    --cc=joel@jms.id.au \
    --cc=johan@kernel.org \
    --cc=juliac@eso.teric.us \
    --cc=kishon@ti.com \
    --cc=kusumi.tomohiro@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mchehab+samsung@kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=pombredanne@nexb.com \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=sandeen@redhat.com \
    --cc=sboyd@codeaurora.org \
    --cc=sdharia@codeaurora.org \
    --cc=tglx@linutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vernon.mauery@linux.intel.com \
    --cc=viresh.kumar@linaro.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).