Re: [PATCH libbsd v2] mmcsd: Don't handle multiple hardware partitions.

2020-04-01 Thread Christian Mauderer
On 01/04/2020 14:10, Sebastian Huber wrote:
> On 01/04/2020 14:09, Christian Mauderer wrote:
> 
>> On 01/04/2020 11:55, Sebastian Huber wrote:
>>> On 01/04/2020 11:45, Christian Mauderer wrote:
 The rtems_bsd_mmcsd_attach_worker acquired the bus without releasing it.
 If a MMC device has multiple hardware partitions (like eMMC which
 typically has at least one boot partition) the
 rtems_bsd_mmcsd_attach_worker would try to acquire the bus multiple
 times. This doesn't work.

 Doing it right would mean to acquire and release the bus for each
 access which would have an performance impact. Beneath that it would
 mean that partition switching has to be supported by the RTEMS code too.

 There is currently no known use case where the access would be
 necessary. Therefore this patch prefers the performance and just avoids
 all further hardware partitions.
>>> Looks good.
>>>
>> Should we apply it only to master or to 5-freebsd-12 too? The problem
>> affects both so I would suggest to apply it to both branches.
> Both branches please.

Thanks. I pushed it.
-- 

embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH libbsd v2] mmcsd: Don't handle multiple hardware partitions.

2020-04-01 Thread Sebastian Huber

On 01/04/2020 14:09, Christian Mauderer wrote:


On 01/04/2020 11:55, Sebastian Huber wrote:

On 01/04/2020 11:45, Christian Mauderer wrote:

The rtems_bsd_mmcsd_attach_worker acquired the bus without releasing it.
If a MMC device has multiple hardware partitions (like eMMC which
typically has at least one boot partition) the
rtems_bsd_mmcsd_attach_worker would try to acquire the bus multiple
times. This doesn't work.

Doing it right would mean to acquire and release the bus for each
access which would have an performance impact. Beneath that it would
mean that partition switching has to be supported by the RTEMS code too.

There is currently no known use case where the access would be
necessary. Therefore this patch prefers the performance and just avoids
all further hardware partitions.

Looks good.


Should we apply it only to master or to 5-freebsd-12 too? The problem
affects both so I would suggest to apply it to both branches.

Both branches please.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH libbsd v2] mmcsd: Don't handle multiple hardware partitions.

2020-04-01 Thread Christian Mauderer
On 01/04/2020 11:55, Sebastian Huber wrote:
> On 01/04/2020 11:45, Christian Mauderer wrote:
>> The rtems_bsd_mmcsd_attach_worker acquired the bus without releasing it.
>> If a MMC device has multiple hardware partitions (like eMMC which
>> typically has at least one boot partition) the
>> rtems_bsd_mmcsd_attach_worker would try to acquire the bus multiple
>> times. This doesn't work.
>>
>> Doing it right would mean to acquire and release the bus for each
>> access which would have an performance impact. Beneath that it would
>> mean that partition switching has to be supported by the RTEMS code too.
>>
>> There is currently no known use case where the access would be
>> necessary. Therefore this patch prefers the performance and just avoids
>> all further hardware partitions.
> 
> Looks good.
> 

Should we apply it only to master or to 5-freebsd-12 too? The problem
affects both so I would suggest to apply it to both branches.

-- 

embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH libbsd v2] mmcsd: Don't handle multiple hardware partitions.

2020-04-01 Thread Sebastian Huber

On 01/04/2020 11:45, Christian Mauderer wrote:

The rtems_bsd_mmcsd_attach_worker acquired the bus without releasing it.
If a MMC device has multiple hardware partitions (like eMMC which
typically has at least one boot partition) the
rtems_bsd_mmcsd_attach_worker would try to acquire the bus multiple
times. This doesn't work.

Doing it right would mean to acquire and release the bus for each
access which would have an performance impact. Beneath that it would
mean that partition switching has to be supported by the RTEMS code too.

There is currently no known use case where the access would be
necessary. Therefore this patch prefers the performance and just avoids
all further hardware partitions.


Looks good.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH libbsd v2] mmcsd: Don't handle multiple hardware partitions.

2020-04-01 Thread Christian Mauderer
The rtems_bsd_mmcsd_attach_worker acquired the bus without releasing it.
If a MMC device has multiple hardware partitions (like eMMC which
typically has at least one boot partition) the
rtems_bsd_mmcsd_attach_worker would try to acquire the bus multiple
times. This doesn't work.

Doing it right would mean to acquire and release the bus for each
access which would have an performance impact. Beneath that it would
mean that partition switching has to be supported by the RTEMS code too.

There is currently no known use case where the access would be
necessary. Therefore this patch prefers the performance and just avoids
all further hardware partitions.
---
 freebsd/sys/dev/mmc/mmcsd.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/freebsd/sys/dev/mmc/mmcsd.c b/freebsd/sys/dev/mmc/mmcsd.c
index 077f8d74..21f54046 100644
--- a/freebsd/sys/dev/mmc/mmcsd.c
+++ b/freebsd/sys/dev/mmc/mmcsd.c
@@ -436,6 +436,15 @@ rtems_bsd_mmcsd_attach_worker(rtems_media_state state, 
const char *src, char **d
goto error;
}
 
+   /*
+* FIXME: There is no release for this acquire. Implementing
+* this would be necessary for:
+* - multiple hardware partitions of eMMC chips
+* - multiple devices on one bus
+*
+* On the other hand it would mean that the bus has to be
+* acquired on every read which would decrease the performance.
+*/
MMCBUS_ACQUIRE_BUS(device_get_parent(dev), dev);
 
status_code = rtems_bsd_mmcsd_set_block_size(dev, block_size);
@@ -764,6 +773,10 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, const 
char *name, u_int cnt,
free(part, M_DEVBUF);
return;
}
+#ifdef __rtems__
+   } else if (type != EXT_CSD_PART_CONFIG_ACC_DEFAULT) {
+   printf("%s: Additional partition. This is currently not 
supported in RTEMS.", part->name);
+#endif /* __rtems__ */
} else {
MMCSD_DISK_LOCK_INIT(part);
 
-- 
2.16.4

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel