All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: dwc3: gadget: make cache-maintenance on event buffers more robust
Date: Wed, 05 Apr 2017 11:15:32 +0300	[thread overview]
Message-ID: <87zifvgti3.fsf@linux.intel.com> (raw)
In-Reply-To: <8bb1f19c-a7f5-bbc8-3a0d-6c2de73a7410@denx.de>


Hi,

Marek Vasut <marex@denx.de> writes:
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index b2c7eb1..f58c7ba 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -125,6 +125,8 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc,
>>  	if (!evt->buf)
>>  		return ERR_PTR(-ENOMEM);
>>  
>> +	dwc3_flush_cache((long)evt->buf, evt->length);
>> +
>
> Is the length aligned ? If not, you will get cache alignment warning.
> Also, address should be uintptr_t to avoid 32/64 bit issues .

if it's not aligned to 128 bits (at least, IIRC), DWC3 won't work.

>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
>> index 1156662..61af71b 100644
>> --- a/drivers/usb/dwc3/gadget.c
>> +++ b/drivers/usb/dwc3/gadget.c
>> @@ -2668,11 +2668,12 @@ void dwc3_gadget_uboot_handle_interrupt(struct dwc3 *dwc)
>>  		int i;
>>  		struct dwc3_event_buffer *evt;
>>  
>> +		dwc3_thread_interrupt(0, dwc);
>> +
>> +		/* Clean + Invalidate the buffers after touching them */
>>  		for (i = 0; i < dwc->num_event_buffers; i++) {
>>  			evt = dwc->ev_buffs[i];
>>  			dwc3_flush_cache((long)evt->buf, evt->length);
>>  		}
>> -
>
> This makes me wonder, don't you need to invalidate the event buffer
> somewhere so that the new data would be fetched from RAM ?

nope. In linux we allocate from coherent

-- 
balbi

  parent reply	other threads:[~2017-04-05  8:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 17:49 [U-Boot] [PATCH] usb: dwc3: gadget: make cache-maintenance on event buffers more robust Philipp Tomsich
2017-04-04 16:15 ` Marek Vasut
2017-04-04 17:46   ` Dr. Philipp Tomsich
2017-04-04 19:01     ` Marek Vasut
2017-04-04 19:56       ` Dr. Philipp Tomsich
2017-04-04 20:09         ` Marek Vasut
2017-04-04 20:26           ` Dr. Philipp Tomsich
2017-04-05 10:25             ` Marek Vasut
2017-04-05 10:57               ` Dr. Philipp Tomsich
2017-04-05 11:25                 ` Marek Vasut
2017-04-05  8:18       ` Felipe Balbi
2017-04-05  8:33         ` Dr. Philipp Tomsich
2017-04-05  9:49           ` Felipe Balbi
2017-04-05  8:43         ` Marek Vasut
2017-04-05  8:15   ` Felipe Balbi [this message]
2017-04-05  8:43     ` Marek Vasut
  -- strict thread matches above, loose matches on Subject: below --
2017-04-08  6:09 mohammadjannati04

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=87zifvgti3.fsf@linux.intel.com \
    --to=felipe.balbi@linux.intel.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.