You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/04/08 07:01:38 UTC

[GitHub] [incubator-nuttx] no1wudi opened a new pull request, #6008: arch/risc-v: Align prototype of riscv_exception with xcpt_t

no1wudi opened a new pull request, #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008

   ## Summary
   Thus we can attach it to irq handler without any cast.
   ## Impact
   Refactor only
   ## Testing
   CI
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#discussion_r845835312


##########
arch/risc-v/src/common/riscv_common_irq.c:
##########
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_common_irq.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+#include <sys/types.h>
+
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void riscv_common_irq_attach(void)

Review Comment:
   Ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] no1wudi commented on pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
no1wudi commented on PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#issuecomment-1093831229

   > @no1wudi please fix the conflict.
   
   OK


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pussuw commented on a diff in pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
pussuw commented on code in PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#discussion_r845846415


##########
arch/risc-v/src/common/riscv_common_irq.c:
##########
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_common_irq.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+#include <sys/types.h>
+
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void riscv_common_irq_attach(void)
+{
+  irq_attach(RISCV_IRQ_IAMISALIGNED, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_IAFAULT, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_IINSTRUCTION, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_BPOINT, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_LAMISALIGNED, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_LAFAULT, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_SAMISALIGNED, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_SAFAULT, riscv_exception, NULL);
+
+  /* Attach the ecall interrupt handler */
+
+#ifndef CONFIG_BUILD_FLAT
+  irq_attach(RISCV_IRQ_ECALLU, riscv_swint, NULL);
+#else
+  irq_attach(RISCV_IRQ_ECALLU, riscv_exception, NULL);
+#endif
+
+  irq_attach(RISCV_IRQ_ECALLS, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_ECALLH, riscv_exception, NULL);
+
+#ifndef CONFIG_ARCH_USE_S_MODE
+  irq_attach(RISCV_IRQ_ECALLM, riscv_swint, NULL);

Review Comment:
   It should be, ECALLS and ECALLM are handled by SBI.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] no1wudi commented on a diff in pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
no1wudi commented on code in PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#discussion_r845820972


##########
arch/risc-v/src/common/riscv_common_irq.c:
##########
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_common_irq.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+#include <sys/types.h>
+
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void riscv_common_irq_attach(void)

Review Comment:
   Yes, we can, but is it too late for exception ? There are many other device operation during irq_initialize (current ) and up_initialize



##########
arch/risc-v/src/common/riscv_common_irq.c:
##########
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_common_irq.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+#include <sys/types.h>
+
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void riscv_common_irq_attach(void)

Review Comment:
   Yes, we can, but is it too late for exception ? There are many other device operations during irq_initialize (current ) and up_initialize



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#discussion_r845835920


##########
arch/risc-v/src/bl602/Make.defs:
##########
@@ -34,7 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
 CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
-CMN_CSRCS += riscv_cpuindex.c
+CMN_CSRCS += riscv_cpuindex.c riscv_common_irq.c

Review Comment:
   riscv_common_irq.c->riscv_irq_common.c align with riscv_exception_common.S?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] no1wudi commented on a diff in pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
no1wudi commented on code in PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#discussion_r845842674


##########
arch/risc-v/src/common/riscv_common_irq.c:
##########
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_common_irq.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+#include <sys/types.h>
+
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void riscv_common_irq_attach(void)
+{
+  irq_attach(RISCV_IRQ_IAMISALIGNED, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_IAFAULT, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_IINSTRUCTION, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_BPOINT, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_LAMISALIGNED, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_LAFAULT, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_SAMISALIGNED, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_SAFAULT, riscv_exception, NULL);
+
+  /* Attach the ecall interrupt handler */
+
+#ifndef CONFIG_BUILD_FLAT
+  irq_attach(RISCV_IRQ_ECALLU, riscv_swint, NULL);
+#else
+  irq_attach(RISCV_IRQ_ECALLU, riscv_exception, NULL);
+#endif
+
+  irq_attach(RISCV_IRQ_ECALLS, riscv_exception, NULL);
+  irq_attach(RISCV_IRQ_ECALLH, riscv_exception, NULL);
+
+#ifndef CONFIG_ARCH_USE_S_MODE
+  irq_attach(RISCV_IRQ_ECALLM, riscv_swint, NULL);

Review Comment:
   @pussuw Could you take a look ? Is it OK for S mode ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] no1wudi commented on a diff in pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
no1wudi commented on code in PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#discussion_r845886982


##########
arch/risc-v/src/bl602/Make.defs:
##########
@@ -34,7 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
 CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
-CMN_CSRCS += riscv_cpuindex.c
+CMN_CSRCS += riscv_cpuindex.c riscv_common_irq.c

Review Comment:
   Maybe move the simple common function to riscv_exception.c is also OK ?
   
   It's just attach standard exception with correspond handler.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] no1wudi commented on a diff in pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
no1wudi commented on code in PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#discussion_r845886982


##########
arch/risc-v/src/bl602/Make.defs:
##########
@@ -34,7 +34,7 @@ CMN_CSRCS += riscv_releasepending.c riscv_reprioritizertr.c
 CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
 CMN_CSRCS += riscv_sigdeliver.c riscv_udelay.c riscv_unblocktask.c riscv_usestack.c
 CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_getnewintctx.c riscv_doirq.c
-CMN_CSRCS += riscv_cpuindex.c
+CMN_CSRCS += riscv_cpuindex.c riscv_common_irq.c

Review Comment:
   OK



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#discussion_r845815216


##########
arch/risc-v/src/common/riscv_common_irq.c:
##########
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_common_irq.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/irq.h>
+#include <sys/types.h>
+
+#include "riscv_internal.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void riscv_common_irq_attach(void)

Review Comment:
   can we move into riscv_initialize.c and call from up_initialize?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6008: arch/risc-v: Attach exception handler in common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6008:
URL: https://github.com/apache/incubator-nuttx/pull/6008#issuecomment-1093789013

   @no1wudi please fix the conflict.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org